Support for collecting staticmethod tests (#2528, #2699)
(self, pytester: Pytester)
| 186 | result.stdout.fnmatch_lines(["*collected 0*"]) |
| 187 | |
| 188 | def test_static_method(self, pytester: Pytester) -> None: |
| 189 | """Support for collecting staticmethod tests (#2528, #2699)""" |
| 190 | pytester.getmodulecol( |
| 191 | """ |
| 192 | import pytest |
| 193 | class Test(object): |
| 194 | @staticmethod |
| 195 | def test_something(): |
| 196 | pass |
| 197 | |
| 198 | @pytest.fixture |
| 199 | def fix(self): |
| 200 | return 1 |
| 201 | |
| 202 | @staticmethod |
| 203 | def test_fix(fix): |
| 204 | assert fix == 1 |
| 205 | """ |
| 206 | ) |
| 207 | result = pytester.runpytest() |
| 208 | result.stdout.fnmatch_lines(["*collected 2 items*", "*2 passed in*"]) |
| 209 | |
| 210 | def test_setup_teardown_class_as_classmethod(self, pytester: Pytester) -> None: |
| 211 | pytester.makepyfile( |
nothing calls this directly
no test coverage detected