-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Unit test execution #1330
Comments
Interesting, I don't get the multiple failures I see in your first run, which look mostly related to the format returned by the Alerter message builder not matching what the test is expecting. I've seen that before I think, I'll look in to it some more. The three failures you get otherwise I can reproduce - they're caused by not having a Just |
I cannot reproduce it at the moment. I wouldn't worry too much.
I confirm that, if "html" exists, the tests pass. It would be really great if the directory is created by simplemonitor's tests when needed (actually, perhaps even using |
I've edited this comment... One more question, related to tests. Could you run the tests this way?:
For me, if I'm in simplemonitor v1.12.0:
Run just with pytest: all good: https://gist.github.com/cpina/1856ceb5af850c21badefea04d44f1ec If I run with "TZ=GMT+12 pytest" I get failures: https://gist.github.com/cpina/8800b9e62af9bf2aee2adf4985d0e75f This came because the default Debian pipeline use reprotest (https://pypi.org/project/reprotest/) to check if a package is reproducible (and the package build step runs tests). I was having issues running some tests. I've just seen that if I'm in the tag v1.12.0: all good (as seen above), if I'm in the HEAD of |
I definitely get failures when overriding the timezone, I'll take a look. Has a feeling of timezone formatting weirdness to it, possibly related to using freezegun for testing time-related things. Nothing silly about that temp dir thing - it really should be doing that, but this was the first project I ever tried writing tests for so was feeling my way through it and learning as I went. I'll look at that too, or you're welcome to if you want :) |
This might be related: spulec/freezegun#526 Regarding the html directory:
Thanks!
I'll let you know if I start. I am pretty busy, I'm trying to prioritise the battles :-) at the moment the Debian package system runs the tests with "-k not test_html" which is not blocking the packaging... |
I've just tested the timezone issue again using. I have: 45fc32f , which includes https://github.com/jamesoff/simplemonitor/pull/1351/files and I see (execution with TZ=BST and TZ=UTC):
|
Thanks for re-testing. I'll have another go at trying to get my head round these :) |
Fixes jamesoff#1330 Some tests wouldn't pass locally if `TZ` was unset, or not set to to, e.g., UTC. One issue was the fallback to `"local"` if `TZ` was unset - this is a valid value internally within simplemonitor, but I don't think valid as a time zone. Also, having many tests use the local timezone creates some unpredictability in cases where there are hardcoded offsets, or where the test depends on the local timezone having a specific offset from UTC. Mock `TZ` as `MST` or `UTC` explicitly in the environment, and adjust existing tests based on offsets from that where needed. Unskip some skipped tests
I ran into a similar issue, before coming across this one. I have some progress towards a fix in #1598. |
Fixes jamesoff#1330 Some tests wouldn't pass locally if `TZ` was unset, or not set to to, e.g., UTC. One issue was the fallback to `"local"` if `TZ` was unset - this is a valid value internally within simplemonitor, but I don't think valid as a time zone. Also, having many tests use the local timezone creates some unpredictability in cases where there are hardcoded offsets, or where the test depends on the local timezone having a specific offset from UTC. Mock `TZ` as `UTC` or `MST` explicitly, and adjust existing tests based on offsets from that where needed. Fix / unskip some skipped tests
Fixes jamesoff#1330 Some tests wouldn't pass locally if `TZ` was unset, or not set to to, e.g., UTC. One issue was the fallback to `"local"` if `TZ` was unset - this is a valid value internally within simplemonitor, but I don't think valid as a time zone. Also, having many tests use the local timezone creates some unpredictability in cases where there are hardcoded offsets, or where the test depends on the local timezone having a specific offset from UTC. Mock `TZ` as `UTC` or `MST` explicitly, and adjust existing tests based on offsets from that where needed. Fix / unskip some skipped tests
Fixes jamesoff#1330 Some tests wouldn't pass locally if `TZ` was unset, or not set to to, e.g., UTC. One issue was the fallback to `"local"` if `TZ` was unset - this is a valid value internally within simplemonitor, but I don't think valid as a time zone. Also, having many tests use the local timezone creates some unpredictability in cases where there are hardcoded offsets, or where the test depends on the local timezone having a specific offset from UTC. Mock `TZ` as `UTC` or `MST` explicitly, and adjust existing tests based on offsets from that where needed. Fix / unskip some skipped tests
Fixes jamesoff#1330 Some tests wouldn't pass locally if `TZ` was unset, or not set to to, e.g., UTC. One issue was the fallback to `"local"` if `TZ` was unset - this is a valid value internally within simplemonitor, but I don't think valid as a time zone. Also, having many tests use the local timezone creates some unpredictability in cases where there are hardcoded offsets, or where the test depends on the local timezone having a specific offset from UTC. Mock `TZ` as `UTC` or `MST` explicitly, and adjust existing tests based on offsets from that where needed. Fix / unskip some skipped tests
Thanks @wyardley for fixing this! Will make simplemonitor package reproducible and no need to skip test on building it. @jamesoff : are you planning a simplemonitor release some time soon? Debian will enter freeze mode next months, in different stages (but until 15th April there shouldn't be any problem, maybe even May but unsure). I'm even considering backporting some recent fixes but I'd like to avoid it if possible. |
@cpina yeah, hoping to get to it this weekend :) |
Super great news, thanks very much! |
In the git checkout
679353b0a0656bdbeed8293bb1a342f76f77417f
, if I run the unit tests withpytest
I get 23 failures (https://gist.github.com/cpina/e1daef2c0687f0a01baaa8d950f44eb4)If I do checkout the version v1.12.0 I get 3 failures (https://gist.github.com/cpina/1d1fa39cd6a9784fce2791ea0dea1cd2).
Two questions:
The text was updated successfully, but these errors were encountered: