Skip to content
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 slow tests without coverage #132

Merged
merged 4 commits into from
Oct 28, 2023

Conversation

PeterJCLaw
Copy link
Collaborator

@PeterJCLaw PeterJCLaw commented Oct 26, 2023

Per suggestion from @alexmojaki at #129 (comment)

These slower tests are integration/kitchen-sink tests, so they shouldn't add substantially to the code coverage. Running them without coverage is quite a lot faster (several minutes in CI) which is well worth the small additional complexity.

This commit also drops pytest outputting the junit xml file as there's not an obvious way to combine that from multiple test runs and it appears to be unused.

This reduces the CI time from ~20 minutes to ~10 minutes, however there's a small reduction in measured coverage. Happy to address that here with unit tests if desired.

Builds on #128.
Fixes #129 as CI time is no longer quite as silly.

Also push the configuration into a config file for reproducibility.
Per suggestion from @alexmojaki at
gristlabs#129 (comment)

These slower tests are integration/kitchen-sink tests, so they
shouldn't add substantially to the code coverage. Running them
without coverage is quite a lot faster (several minutes in CI)
which is well worth the small additional complexity.

This commit also drops pytest outputting the junit xml file
as there's not an obvious way to combine that from multiple
test runs and it appears to be unused.
@PeterJCLaw PeterJCLaw force-pushed the slow-tests-no-coverage branch from 7ca590b to 36fd09b Compare October 26, 2023 20:59
@alexmojaki
Copy link
Contributor

Please don't @ me in commit messages, it does weird things with github notifications

@PeterJCLaw
Copy link
Collaborator Author

Oh, sorry, hadn't thought about that. Yeah, I suspect it combined badly with force pushing a few times to fix CI.

@PeterJCLaw PeterJCLaw marked this pull request as ready for review October 26, 2023 21:14
@alexmojaki
Copy link
Contributor

Hmmm, I feel weird about having two mechanisms for dealing with slow tests: ASTTOKENS_SLOW_TESTS and the pytest marker.

@PeterJCLaw
Copy link
Collaborator Author

Hmmm, I feel weird about having two mechanisms for dealing with slow tests: ASTTOKENS_SLOW_TESTS and the pytest marker.

Ah, good point. Do you think that having some of the sys.modules tests in the normal suite adds value? If not, we could just push them entirely into the slow suite and drop ASTTOKENS_SLOW_TESTS. On the other hand doing that would mean that locally the default would be to run all the tests, which might not be ideal for rapid iteration. A script which just runs the fast subset might be useful to help there? (Unless there's a way to default pytest to not running a particular mark?)

@PeterJCLaw
Copy link
Collaborator Author

Unless there's a way to default pytest to not running a particular mark?

There is! We can add -m 'not slow' to the adopts key in setup.cfg. That can still be overridden on the command line (-m '' to run everything, -m slow to run just the slow ones), so that feels like it's probably ideal here.

Concretely then I'm proposing:

  • add -m 'not slow' to adopts (setting that as the default)
  • remove ASTTOKENS_SLOW_TESTS completely
  • leave CI explicitly setting -m as it is now
  • maybe document these in the README?

This is somewhat redundant now that we have pytest markers for slow
tests, having only a single approach to running slow tests simplifies
things.
@PeterJCLaw
Copy link
Collaborator Author

Have implemented that approach in 52e9b41.

@alexmojaki
Copy link
Contributor

This looks great, thank you!

@alexmojaki alexmojaki merged commit 572a28c into gristlabs:master Oct 28, 2023
20 checks passed
@PeterJCLaw PeterJCLaw deleted the slow-tests-no-coverage branch October 29, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI is absurdly slow
2 participants