(pytester: Pytester)
| 51 | |
| 52 | |
| 53 | def test_nose_setup_func(pytester: Pytester) -> None: |
| 54 | p = pytester.makepyfile( |
| 55 | """ |
| 56 | from nose.tools import with_setup |
| 57 | |
| 58 | values = [] |
| 59 | |
| 60 | def my_setup(): |
| 61 | a = 1 |
| 62 | values.append(a) |
| 63 | |
| 64 | def my_teardown(): |
| 65 | b = 2 |
| 66 | values.append(b) |
| 67 | |
| 68 | @with_setup(my_setup, my_teardown) |
| 69 | def test_hello(): |
| 70 | print(values) |
| 71 | assert values == [1] |
| 72 | |
| 73 | def test_world(): |
| 74 | print(values) |
| 75 | assert values == [1,2] |
| 76 | |
| 77 | """ |
| 78 | ) |
| 79 | result = pytester.runpytest(p, "-p", "nose") |
| 80 | result.assert_outcomes(passed=2) |
| 81 | |
| 82 | |
| 83 | def test_nose_setup_func_failure(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected