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

Method test_parametrize_and_scope

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

Source from the content-addressed store, hash-verified

2527 reprec.assertoutcome(passed=1)
2528
2529 def test_parametrize_and_scope(self, pytester: Pytester) -> None:
2530 pytester.makepyfile(
2531 """
2532 import pytest
2533 @pytest.fixture(scope="module", params=["a", "b", "c"])
2534 def arg(request):
2535 return request.param
2536 values = []
2537 def test_param(arg):
2538 values.append(arg)
2539 """
2540 )
2541 reprec = pytester.inline_run("-v")
2542 reprec.assertoutcome(passed=3)
2543 values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
2544 assert len(values) == 3
2545 assert "a" in values
2546 assert "b" in values
2547 assert "c" in values
2548
2549 def test_scope_mismatch(self, pytester: Pytester) -> None:
2550 pytester.makeconftest(

Callers

nothing calls this directly

Calls 4

assertoutcomeMethod · 0.80
getcallsMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected