feat: allow setting tags on parametrized sessions #832
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To allow more fine-grained session selection, allow tags to be set on individual parametrized sessions via either a tags argument to the
@nox.parametrize()
decorator, or a tags argument tonox.param()
(similar to how parametrized session IDs can be specified). Any tags specified this way will be added to any tags passed to the@nox.session()
decorator.A couple of examples of how this could be used:
In this case, a developer could run
nox -t sqlite
to run just the tests with all versions of Django but only using the SQLite backend.Here's a more complex example:
This tags the Python 3.12/Django 5 combination with the
quick
tag, allowing the developer to run a quick sanity check on the code using a single entry from the test matrix. It also tags any combination of Python 3.12 or Django 5 with thestandard
tag, allowing the developer to run the tests using Python 3.12 with all versions of Django along with all versions of Python with Django 5, which should give fairly comprehensive test coverage while only having to run five entries from the test matrix instead of nine.