(pytester: Pytester)
| 278 | |
| 279 | |
| 280 | def test_setup_setUpClass(pytester: Pytester) -> None: |
| 281 | testpath = pytester.makepyfile( |
| 282 | """ |
| 283 | import unittest |
| 284 | import pytest |
| 285 | class MyTestCase(unittest.TestCase): |
| 286 | x = 0 |
| 287 | @classmethod |
| 288 | def setUpClass(cls): |
| 289 | cls.x += 1 |
| 290 | def test_func1(self): |
| 291 | assert self.x == 1 |
| 292 | def test_func2(self): |
| 293 | assert self.x == 1 |
| 294 | @classmethod |
| 295 | def tearDownClass(cls): |
| 296 | cls.x -= 1 |
| 297 | def test_teareddown(): |
| 298 | assert MyTestCase.x == 0 |
| 299 | """ |
| 300 | ) |
| 301 | reprec = pytester.inline_run(testpath) |
| 302 | reprec.assertoutcome(passed=3) |
| 303 | |
| 304 | |
| 305 | def test_fixtures_setup_setUpClass_issue8394(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected