(pytester: Pytester)
| 7 | |
| 8 | |
| 9 | def test_nose_setup(pytester: Pytester) -> None: |
| 10 | p = pytester.makepyfile( |
| 11 | """ |
| 12 | values = [] |
| 13 | from nose.tools import with_setup |
| 14 | |
| 15 | @with_setup(lambda: values.append(1), lambda: values.append(2)) |
| 16 | def test_hello(): |
| 17 | assert values == [1] |
| 18 | |
| 19 | def test_world(): |
| 20 | assert values == [1,2] |
| 21 | |
| 22 | test_hello.setup = lambda: values.append(1) |
| 23 | test_hello.teardown = lambda: values.append(2) |
| 24 | """ |
| 25 | ) |
| 26 | result = pytester.runpytest(p, "-p", "nose") |
| 27 | result.assert_outcomes(passed=2) |
| 28 | |
| 29 | |
| 30 | def test_setup_func_with_setup_decorator() -> None: |
nothing calls this directly
no test coverage detected