-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run tests without API keys, and without networking #13
Comments
Or maybe not new switches, but skip the tests if CLUBLOG_APIKEY and QRZ_USERNAME aren't set. |
Hey Christoph, cool - thanks for your efforts in brinding pyhamtools to Debian! It seems that I must have tried to make the package testable without internet connection some time ago /test/conftest.py: try:
APIKEY = str(os.environ['CLUBLOG_APIKEY'])
QRZ_USERNAME = str(os.environ['QRZ_USERNAME'])
QRZ_PWD = str(os.environ['QRZ_PWD'])
except Exception as ex:
print("WARNING: Environment variables with API keys not set; some tests will be skipped") and /test/test_lookuplib_qrz.py try:
QRZ_USERNAME = str(os.environ['QRZ_USERNAME'])
QRZ_PWD = str(os.environ['QRZ_PWD'])
except Exception:
pytestmark = pytest.mark.skip("Environment variables with QRZ.com credentials not set") But it seems that I haven't finished it (yet) 😢 As you pointed out, I think the best approach is to skip the That said, for some of the tests I'm using static fixtures in order to ensure reproducibility of the tests. All of those fixtures are located in /test/fixtures folder. WRT Redis I'm not sure what is the best way. Maybe a brief check if the redis client can connect to the redis server on port 6379 during setup in /test/conftest.py I think I will deprecate redis anyway in the long term. There are now so may cache solutions out there available. I think it should be therefore left to the user to decide which cache system to use... but that's for another day 😉 I'm kinda busy the next 2 weeks and I can't promise that I'll be able to include all the changes this year. But if you are in the mood, I would happily accept a PR! 73 Tobias |
Hi Tobias, For the test, I'm not very fluent in python yet, and we don't really need to run the full testsuite in Debian, so I put a limited smoke test that simply calls a few functions into https://salsa.debian.org/debian-hamradio-team/pyhamtools/blob/debian/debian/tests/test. But if you get the testsuite running without the API keys, I'll definitely revisit that and try to run it from the Debian CI pipeline. 73, Christoph |
Hi,
I'm working on getting pyhamtools into Debian because I'm using it for my logbook [1]. I have the packaging ready [2], but the testsuite is failing because I'm running without QRZ/clublog API keys (and I don't want to give these to the Debian buildd network). Also, we have the requirements that builds shouldn't be accessing the internet. Could we maybe have
Thanks,
Christoph DF7CB
[1] https://github.com/df7cb/df7cb-log
[2] https://salsa.debian.org/debian-hamradio-team/pyhamtools
The text was updated successfully, but these errors were encountered: