MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_scope_mismatch_various

Method test_scope_mismatch_various

testing/python/fixtures.py:2418–2443  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

2416 reprec.assertoutcome(passed=4)
2417
2418 def test_scope_mismatch_various(self, pytester: Pytester) -> None:
2419 pytester.makeconftest(
2420 """
2421 import pytest
2422 finalized = []
2423 created = []
2424 @pytest.fixture(scope="function")
2425 def arg(request):
2426 pass
2427 """
2428 )
2429 pytester.makepyfile(
2430 test_mod1="""
2431 import pytest
2432 @pytest.fixture(scope="session")
2433 def arg(request):
2434 request.getfixturevalue("arg")
2435 def test_1(arg):
2436 pass
2437 """
2438 )
2439 result = pytester.runpytest()
2440 assert result.ret != 0
2441 result.stdout.fnmatch_lines(
2442 ["*ScopeMismatch*You tried*function*session*request*"]
2443 )
2444
2445 def test_dynamic_scope(self, pytester: Pytester) -> None:
2446 pytester.makeconftest(

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makeconftestMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected