MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_non_unittest_no_setupclass_support

Function test_non_unittest_no_setupclass_support

testing/test_unittest.py:866–889  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

864
865
866def test_non_unittest_no_setupclass_support(pytester: Pytester) -> None:
867 testpath = pytester.makepyfile(
868 """
869 class TestFoo(object):
870 x = 0
871
872 @classmethod
873 def setUpClass(cls):
874 cls.x = 1
875
876 def test_method1(self):
877 assert self.x == 0
878
879 @classmethod
880 def tearDownClass(cls):
881 cls.x = 1
882
883 def test_not_teareddown():
884 assert TestFoo.x == 0
885
886 """
887 )
888 reprec = pytester.inline_run(testpath)
889 reprec.assertoutcome(passed=2)
890
891
892def test_no_teardown_if_setupclass_failed(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

assertoutcomeMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected