(pytester: Pytester)
| 124 | |
| 125 | |
| 126 | def test_nose_setup_partial(pytester: Pytester) -> None: |
| 127 | pytest.importorskip("functools") |
| 128 | p = pytester.makepyfile( |
| 129 | """ |
| 130 | from functools import partial |
| 131 | |
| 132 | values = [] |
| 133 | |
| 134 | def my_setup(x): |
| 135 | a = x |
| 136 | values.append(a) |
| 137 | |
| 138 | def my_teardown(x): |
| 139 | b = x |
| 140 | values.append(b) |
| 141 | |
| 142 | my_setup_partial = partial(my_setup, 1) |
| 143 | my_teardown_partial = partial(my_teardown, 2) |
| 144 | |
| 145 | def test_hello(): |
| 146 | print(values) |
| 147 | assert values == [1] |
| 148 | |
| 149 | def test_world(): |
| 150 | print(values) |
| 151 | assert values == [1,2] |
| 152 | |
| 153 | test_hello.setup = my_setup_partial |
| 154 | test_hello.teardown = my_teardown_partial |
| 155 | """ |
| 156 | ) |
| 157 | result = pytester.runpytest(p, "-p", "nose") |
| 158 | result.stdout.fnmatch_lines(["*2 passed*"]) |
| 159 | |
| 160 | |
| 161 | def test_module_level_setup(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected