-
Notifications
You must be signed in to change notification settings - Fork 4
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
infra: Improve testing usability #117
Conversation
now |
Some observations:
So, apparently, appending an extra arg (probably random) re-enables doctests |
Also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the doctest issue, potentially with my proposition. Otherwise all good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy with it but I did not rigorously review it, since @leclairm already had a look
@@ -38,7 +38,7 @@ jobs: | |||
env: | |||
PYTEST_ADDOPTS: "--durations=0" | |||
run: | | |||
hatch test --cover | |||
hatch test -m "" --parallel --cover # override default exclusion of slow tests with -m "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah super nice that hatch already comes with pytest-xdist and coverage
Improve testing usability
mark slow tests and deselect them by default (but not on CI)
Mark the test running AiiDA as slow. Change the default test args to include -m "not slow", which can be overridden by passing -m "".
Now to run the fast tests during development we can use the default
Whereas on CI or to manually run everything we use
which overrides any selection based on marks (consequently selecting everything).
ignore warnings from libraries and default to treating warnings as errors
This will save us from building up third party warnings from code out of our control in the test output until the actual test results get pushed out of the console history (tends to happen in python projects over time).
Now we have to decide for every warning we get, whether we can / need to deal with it or should ignore it explicitly in the config.
cmdline option for regenerating serialized references
The skipped tests which could be manually un-skipped to update references had their logic moved into a config hook for pytest, which checks for a custom cmdline option. We can now:
to regenerate everything (can be differenciated in the future by type of data if regenerating everything ever becomes too slow).
parallelize tests on CI
--parallel
option was added tohatch test
on CI (github runners can typically not run many workers, so the speedup is probably small)