From 6ae0f741ef646267fdebfa05dcc1c44c66e5b9fc Mon Sep 17 00:00:00 2001 From: Joseph Lucas Date: Wed, 9 Sep 2020 09:33:39 -0400 Subject: [PATCH] Add example for __test__ (#7733) Co-authored-by: Bruno Oliveira --- doc/en/example/pythoncollection.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index a12e2deaa..c2f034839 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -313,3 +313,12 @@ interpreter: collect_ignore = ["setup.py"] if sys.version_info[0] > 2: collect_ignore_glob = ["*_py2.py"] + +Since Pytest 2.6, users can prevent pytest from discovering classes that start +with ``Test`` by setting a boolean ``__test__`` attribute to ``False``. + +.. code-block:: python + + # Will not be discovered as a test + class TestClass: + __test__ = False