Ensure that fixtures are created according to scope order (#2405).
(pytester: Pytester)
| 1081 | |
| 1082 | |
| 1083 | def test_fixture_order_respects_scope(pytester: Pytester) -> None: |
| 1084 | """Ensure that fixtures are created according to scope order (#2405).""" |
| 1085 | pytester.makepyfile( |
| 1086 | """ |
| 1087 | import pytest |
| 1088 | |
| 1089 | data = {} |
| 1090 | |
| 1091 | @pytest.fixture(scope='module') |
| 1092 | def clean_data(): |
| 1093 | data.clear() |
| 1094 | |
| 1095 | @pytest.fixture(autouse=True) |
| 1096 | def add_data(): |
| 1097 | data.update(value=True) |
| 1098 | |
| 1099 | @pytest.mark.usefixtures('clean_data') |
| 1100 | def test_value(): |
| 1101 | assert data.get('value') |
| 1102 | """ |
| 1103 | ) |
| 1104 | result = pytester.runpytest() |
| 1105 | assert result.ret == 0 |
| 1106 | |
| 1107 | |
| 1108 | def test_frame_leak_on_failing_test(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected