@@ -517,6 +517,8 @@ The :mod:`!test.support` module defines the following functions:
517517 ``True `` if called by a function whose ``__name__ `` is ``'__main__' ``.
518518 Used when tests are executed by :mod: `test.regrtest `.
519519
520+ If called at the top level, sets label "requires\_\ *resource *" on the module.
521+
520522
521523.. function :: sortdict(dict)
522524
@@ -533,6 +535,29 @@ The :mod:`!test.support` module defines the following functions:
533535 rather than looking directly in the path directories.
534536
535537
538+ .. function :: mark(label, value=True, /)
539+
540+ Add a label to a test. Use ``@mark('label') `` as a decorator of a test
541+ method or class.
542+
543+ The optional *value * (``True `` by default) is matched on the command line
544+ by ``--label label=value ``, whereas ``--label label `` matches any value.
545+
546+ Many :mod: `test.support ` decorators like :func: `requires_resource `,
547+ :func: `~test.support.cpython_only ` or :func: `bigmemtest ` add labels
548+ automatically.
549+
550+
551+ .. function :: mark_module(label, value=True, /, *, globals=None)
552+
553+ Add a label to every test of a module. Call it at the module level::
554+
555+ test.support.mark_module('pickletest')
556+
557+ The module is the caller, unless its :func: `globals ` dict is passed as the
558+ *globals * argument.
559+
560+
536561.. function :: get_pagesize()
537562
538563 Get size of a page in bytes.
@@ -777,26 +802,31 @@ The :mod:`!test.support` module defines the following functions:
777802.. decorator :: requires_zlib
778803
779804 Decorator for skipping tests if :mod: `zlib ` doesn't exist.
805+ Adds label "requires_zlib".
780806
781807
782808.. decorator :: requires_gzip
783809
784810 Decorator for skipping tests if :mod: `gzip ` doesn't exist.
811+ Adds label "requires_gzip".
785812
786813
787814.. decorator :: requires_bz2
788815
789816 Decorator for skipping tests if :mod: `bz2 ` doesn't exist.
817+ Adds label "requires_bz2".
790818
791819
792820.. decorator :: requires_lzma
793821
794822 Decorator for skipping tests if :mod: `lzma ` doesn't exist.
823+ Adds label "requires_lzma".
795824
796825
797826.. decorator :: requires_resource(resource)
798827
799828 Decorator for skipping tests if *resource * is not available.
829+ Adds label "requires\_\ *resource *".
800830
801831
802832.. decorator :: requires_docstrings
@@ -813,12 +843,17 @@ The :mod:`!test.support` module defines the following functions:
813843.. decorator :: cpython_only
814844
815845 Decorator for tests only applicable to CPython.
846+ Adds label "impl_detail_cpython".
816847
817848
818849.. decorator :: impl_detail(msg=None, **guards)
819850
820851 Decorator for invoking :func: `check_impl_detail ` on *guards *. If that
821852 returns ``False ``, then uses *msg * as the reason for skipping the test.
853+ For every keyword argument *name * adds a label
854+ "impl_detail\_\ *name *" if its value is true or
855+ "impl_detail_no\_\ *name *" otherwise.
856+
822857
823858.. decorator :: thread_unsafe(reason=None)
824859
@@ -853,10 +888,13 @@ The :mod:`!test.support` module defines the following functions:
853888 method may be less than the requested value. If *dry_run * is ``False ``, it
854889 means the test doesn't support dummy runs when ``-M `` is not specified.
855890
891+ Adds label "bigmemtest".
892+
856893
857894.. decorator :: bigaddrspacetest
858895
859896 Decorator for tests that fill the address space.
897+ Adds label "bigaddrspacetest".
860898
861899
862900.. function :: linked_to_musl()
@@ -1800,6 +1838,8 @@ Importing modules
18001838 optional for others, set *required_on * to an iterable of platform prefixes
18011839 which will be compared against :data: `sys.platform `.
18021840
1841+ If called at the top level, sets label "requires\_\ *name *" on the module.
1842+
18031843 .. versionadded :: 3.1
18041844
18051845.. function :: import_fresh_module(name, fresh=(), blocked=(), *, deprecated=False, usefrozen=False)
0 commit comments