@@ -482,6 +482,8 @@ The :mod:`test.support` module defines the following functions:
482482 ``True `` if called by a function whose ``__name__ `` is ``'__main__' ``.
483483 Used when tests are executed by :mod: `test.regrtest `.
484484
485+ If called at the top level, sets label "requires _\ *resource *" on the module.
486+
485487
486488.. function :: sortdict(dict)
487489
@@ -498,16 +500,34 @@ The :mod:`test.support` module defines the following functions:
498500 rather than looking directly in the path directories.
499501
500502
503+ .. function :: mark(label, *, globals=None)
504+
505+ Add a label to tests.
506+ The ``@mark('label') `` decorator adds a label to method or class.
507+ ``test.support.mark('label', globals=globals()) `` adds a label to the whole
508+ module.
509+
510+ Many :mod: `test.support ` decorators like :func: `requires_resource `,
511+ :func: `~test.support.cpython_only ` or :func: `bigmemtest ` add labels
512+ automatically.
513+
514+
501515.. function :: match_test(test)
502516
503- Determine whether *test * matches the patterns set in :func: `set_match_tests `.
517+ Determine whether *test * matches the patterns set in :func: `set_match_tests `
518+ and labels set in :func: `set_match_tests2 `.
504519
505520
506521.. function :: set_match_tests(accept_patterns=None, ignore_patterns=None)
507522
508523 Define match patterns on test filenames and test method names for filtering tests.
509524
510525
526+ .. function :: set_match_tests2(accept_labels=None, ignore_labels=None)
527+
528+ Define labels on tests for filtering.
529+
530+
511531.. function :: run_unittest(*classes)
512532
513533 Execute :class: `unittest.TestCase ` subclasses passed to the function. The
@@ -774,26 +794,31 @@ The :mod:`test.support` module defines the following functions:
774794.. decorator :: requires_zlib
775795
776796 Decorator for skipping tests if :mod: `zlib ` doesn't exist.
797+ Adds label "requires_zlib".
777798
778799
779800.. decorator :: requires_gzip
780801
781802 Decorator for skipping tests if :mod: `gzip ` doesn't exist.
803+ Adds label "requires_gzip".
782804
783805
784806.. decorator :: requires_bz2
785807
786808 Decorator for skipping tests if :mod: `bz2 ` doesn't exist.
809+ Adds label "requires_bz2".
787810
788811
789812.. decorator :: requires_lzma
790813
791814 Decorator for skipping tests if :mod: `lzma ` doesn't exist.
815+ Adds label "requires_lzma".
792816
793817
794818.. decorator :: requires_resource(resource)
795819
796820 Decorator for skipping tests if *resource * is not available.
821+ Adds label "requires _\ *resource *".
797822
798823
799824.. decorator :: requires_docstrings
@@ -810,13 +835,16 @@ The :mod:`test.support` module defines the following functions:
810835.. decorator :: cpython_only
811836
812837 Decorator for tests only applicable to CPython.
838+ Adds label "impl_detail_cpython".
813839
814840
815841.. decorator :: impl_detail(msg=None, **guards)
816842
817843 Decorator for invoking :func: `check_impl_detail ` on *guards *. If that
818844 returns ``False ``, then uses *msg * as the reason for skipping the test.
819-
845+ For every keyword argument *implname * adds a label
846+ "impl_detail _\ *implname *" if its value is true or
847+ "impl_detail_no _\ *implname *" otherwise.
820848
821849.. decorator :: no_tracing
822850
@@ -845,10 +873,13 @@ The :mod:`test.support` module defines the following functions:
845873 method may be less than the requested value. If *dry_run * is ``False ``, it
846874 means the test doesn't support dummy runs when ``-M `` is not specified.
847875
876+ Adds label "bigmemtest".
877+
848878
849879.. decorator :: bigaddrspacetest
850880
851881 Decorator for tests that fill the address space.
882+ Adds label "bigaddrspacetest".
852883
853884
854885.. function :: check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=None)
@@ -1630,6 +1661,8 @@ The :mod:`test.support.import_helper` module provides support for import tests.
16301661 optional for others, set *required_on * to an iterable of platform prefixes
16311662 which will be compared against :data: `sys.platform `.
16321663
1664+ If called at the top level, sets label "requires _\ *name *" on the module.
1665+
16331666 .. versionadded :: 3.1
16341667
16351668
0 commit comments