-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-108828: Support selecting tests by labels #108829
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
Open
serhiy-storchaka
wants to merge
7
commits into
python:main
Choose a base branch
from
serhiy-storchaka:libregrtest-labels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6ea2f47
gh-108828: Support selecting tests by labels
serhiy-storchaka 16ee29f
Support marking modules.
serhiy-storchaka fe7fcd0
Add documentation.
serhiy-storchaka 5ae7161
Fix Sphinx warnings.
serhiy-storchaka 4f41c75
Merge branch 'main' into libregrtest-labels
serhiy-storchaka c884b55
Make the order of options matter.
serhiy-storchaka 22d68c6
Merge branch 'main' into libregrtest-labels
serhiy-storchaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -482,6 +482,8 @@ The :mod:`test.support` module defines the following functions: | |||||
``True`` if called by a function whose ``__name__`` is ``'__main__'``. | ||||||
Used when tests are executed by :mod:`test.regrtest`. | ||||||
|
||||||
If called at the top level, sets label "requires\_\ *resource*" on the module. | ||||||
|
||||||
|
||||||
.. function:: sortdict(dict) | ||||||
|
||||||
|
@@ -498,6 +500,18 @@ The :mod:`test.support` module defines the following functions: | |||||
rather than looking directly in the path directories. | ||||||
|
||||||
|
||||||
.. function:: mark(label, *, globals=None) | ||||||
|
||||||
Add a label to tests. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
The ``@mark('label')`` decorator adds a label to method or class. | ||||||
``test.support.mark('label', globals=globals())`` adds a label to the whole | ||||||
module. | ||||||
|
||||||
Many :mod:`test.support` decorators like :func:`requires_resource`, | ||||||
:func:`~test.support.cpython_only` or :func:`bigmemtest` add labels | ||||||
automatically. | ||||||
|
||||||
|
||||||
.. function:: get_pagesize() | ||||||
|
||||||
Get size of a page in bytes. | ||||||
|
@@ -736,26 +750,31 @@ The :mod:`test.support` module defines the following functions: | |||||
.. decorator:: requires_zlib | ||||||
|
||||||
Decorator for skipping tests if :mod:`zlib` doesn't exist. | ||||||
Adds label "requires_zlib". | ||||||
|
||||||
|
||||||
.. decorator:: requires_gzip | ||||||
|
||||||
Decorator for skipping tests if :mod:`gzip` doesn't exist. | ||||||
Adds label "requires_gzip". | ||||||
|
||||||
|
||||||
.. decorator:: requires_bz2 | ||||||
|
||||||
Decorator for skipping tests if :mod:`bz2` doesn't exist. | ||||||
Adds label "requires_bz2". | ||||||
|
||||||
|
||||||
.. decorator:: requires_lzma | ||||||
|
||||||
Decorator for skipping tests if :mod:`lzma` doesn't exist. | ||||||
Adds label "requires_lzma". | ||||||
|
||||||
|
||||||
.. decorator:: requires_resource(resource) | ||||||
|
||||||
Decorator for skipping tests if *resource* is not available. | ||||||
Adds label "requires\_\ *resource*". | ||||||
|
||||||
|
||||||
.. decorator:: requires_docstrings | ||||||
|
@@ -772,13 +791,16 @@ The :mod:`test.support` module defines the following functions: | |||||
.. decorator:: cpython_only | ||||||
|
||||||
Decorator for tests only applicable to CPython. | ||||||
Adds label "impl_detail_cpython". | ||||||
|
||||||
|
||||||
.. decorator:: impl_detail(msg=None, **guards) | ||||||
|
||||||
Decorator for invoking :func:`check_impl_detail` on *guards*. If that | ||||||
returns ``False``, then uses *msg* as the reason for skipping the test. | ||||||
|
||||||
For every keyword argument *name* adds a label | ||||||
"impl_detail\_\ *name*" if its value is true or | ||||||
"impl_detail_no\_\ *name*" otherwise. | ||||||
|
||||||
.. decorator:: no_tracing | ||||||
|
||||||
|
@@ -807,10 +829,13 @@ The :mod:`test.support` module defines the following functions: | |||||
method may be less than the requested value. If *dry_run* is ``False``, it | ||||||
EDBE td> | means the test doesn't support dummy runs when ``-M`` is not specified. | |||||
|
||||||
Adds label "bigmemtest". | ||||||
|
||||||
|
||||||
.. decorator:: bigaddrspacetest | ||||||
|
||||||
Decorator for tests that fill the address space. | ||||||
Adds label "bigaddrspacetest". | ||||||
|
||||||
|
||||||
.. function:: check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=None) | ||||||
|
@@ -1592,6 +1617,8 @@ The :mod:`test.support.import_helper` module provides support for import tests. | |||||
optional for others, set *required_on* to an iterable of platform prefixes | ||||||
which will be compared against :data:`sys.platform`. | ||||||
|
||||||
If called at the top level, sets label "requires\_\ *name*" on the module. | ||||||
|
||||||
.. versionadded:: 3.1 | ||||||
|
||||||
|
||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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 would prefer to always call them "marks". The main reason is that
pytest
uses the same idea and pytest's marks are well-known.Right now
mark
function adds a "label". It does not sound right.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.
Or we can always call it "label".
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.
Yes, it is similar to pytest's markers, but there are enough differences in applying them and filtering by them. I do not have preference, "label", "marker" and "tag" are all look like synonyms in this context to me.