-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add tox.ini to easily test multiple Python versions #343
Conversation
Okay, another thing blocked until we can move to 3.12 beta :) Using tox to just https://github.com/hugovk/blurb_it/actions/runs/5154209675 |
Same issue that I had in python/bedevere#547 (comment)! |
Close/re-open in case it helps the CLA bot. |
Updated to call pytest to measure/report coverage of all module and test code. Similar to cherry_picker, and more accurately reports the current situation: Before
After
|
--cov blurb_it | ||
--cov tests | ||
--cov-report html | ||
--cov-report term | ||
--cov-report xml |
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.
The disadvantage of putting this config in pytest.ini
rather than .coveragerc
is that running pytest
locally will now run pytest under coverage -- there's now no way to "just run pytest without a coverage report". Whereas if the config was in .coveragerc
, we could run pytest
locally to run the tests, and coverage run -m pytest
to run the tests under coverage.
The tests in this repo are (at the moment) extremely fast, however, so there's not really any reason to not run tests under coverage. So I'm okay with this!
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 don't use tox much myself, but this LGTM! The coverage config changes are a big improvement -- they highlight that we currently have a lot of code in __main__.py
that isn't being exercised by our tests at all.
Makes it easier to test locally. Also use it in GitHub Actions, this means the
tox.ini
file itself is tested.Some example commands:
I left Python 3.12 out for now, because we can't yet test against the betas (#330 (comment)) and if we include it, then plain
tox
will try and run it and fail. We can still test on demand withtox -e py312
.I also formatted
tox.ini
using https://github.com/tox-dev/tox-ini-fmt (we could add that to a pre-commit hook).