def test_can_skip_class_with_test_attr(self, pytester: Pytester) -> None:
        """Assure test class is skipped when using `__test__=False` (See #2007)."""
        pytester.makepyfile(
            """
            class TestFoo(object):
                __test__ = False
                def __init__(self):
                    pass
                def test_foo():
                    assert True
        """
        )
        result = pytester.runpytest()
        result.stdout.fnmatch_lines(["collected 0 items", "*no tests ran in*"])
Assure test class is skipped when using `__test__=False` (See #2007).
testing/test_collection.py