File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2464,6 +2464,31 @@ def test_1(arg):
24642464 ["*ScopeMismatch*You tried*function*session*request*" ]
24652465 )
24662466
2467+ def test_scope_mismatch_already_computed_dynamic (self , pytester : Pytester ) -> None :
2468+ pytester .makepyfile (
2469+ test_it = """
2470+ import pytest
2471+
2472+ @pytest.fixture(scope="function")
2473+ def fixfunc(): pass
2474+
2475+ @pytest.fixture(scope="module")
2476+ def fixmod(fixfunc): pass
2477+
2478+ def test_it(request, fixfunc):
2479+ request.getfixturevalue("fixmod")
2480+ """ ,
2481+ )
2482+
2483+ result = pytester .runpytest ()
2484+ assert result .ret == ExitCode .TESTS_FAILED
2485+ result .stdout .fnmatch_lines (
2486+ [
2487+ "*ScopeMismatch*involved factories*" ,
2488+ "test_it.py:6: def fixmod(fixfunc)" ,
2489+ ]
2490+ )
2491+
24672492 def test_dynamic_scope (self , pytester : Pytester ) -> None :
24682493 pytester .makeconftest (
24692494 """
You can’t perform that action at this time.
0 commit comments