(pytester: Pytester)
| 37 | |
| 38 | |
| 39 | def test_fixtures_in_conftest(pytester: Pytester) -> None: |
| 40 | pytester.makeconftest( |
| 41 | ''' |
| 42 | import pytest |
| 43 | @pytest.fixture |
| 44 | def arg1(): |
| 45 | """arg1 docstring""" |
| 46 | @pytest.fixture |
| 47 | def arg2(): |
| 48 | """arg2 docstring""" |
| 49 | @pytest.fixture |
| 50 | def arg3(arg1, arg2): |
| 51 | """arg3 |
| 52 | docstring |
| 53 | """ |
| 54 | ''' |
| 55 | ) |
| 56 | p = pytester.makepyfile( |
| 57 | """ |
| 58 | def test_arg2(arg2): |
| 59 | pass |
| 60 | def test_arg3(arg3): |
| 61 | pass |
| 62 | """ |
| 63 | ) |
| 64 | result = pytester.runpytest("--fixtures-per-test", p) |
| 65 | assert result.ret == 0 |
| 66 | |
| 67 | result.stdout.fnmatch_lines( |
| 68 | [ |
| 69 | "*fixtures used by test_arg2*", |
| 70 | "*(test_fixtures_in_conftest.py:2)*", |
| 71 | "arg2 -- conftest.py:6", |
| 72 | " arg2 docstring", |
| 73 | "*fixtures used by test_arg3*", |
| 74 | "*(test_fixtures_in_conftest.py:4)*", |
| 75 | "arg1 -- conftest.py:3", |
| 76 | " arg1 docstring", |
| 77 | "arg2 -- conftest.py:6", |
| 78 | " arg2 docstring", |
| 79 | "arg3 -- conftest.py:9", |
| 80 | " arg3", |
| 81 | ] |
| 82 | ) |
| 83 | |
| 84 | |
| 85 | def test_should_show_fixtures_used_by_test(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected