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

Method test_usefixtures_ini

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

Source from the content-addressed store, hash-verified

1405 reprec.assertoutcome(passed=2)
1406
1407 def test_usefixtures_ini(self, pytester: Pytester) -> None:
1408 pytester.makeini(
1409 """
1410 [pytest]
1411 usefixtures = myfix
1412 """
1413 )
1414 pytester.makeconftest(
1415 """
1416 import pytest
1417
1418 @pytest.fixture(scope="class")
1419 def myfix(request):
1420 request.cls.hello = "world"
1421
1422 """
1423 )
1424 pytester.makepyfile(
1425 """
1426 class TestClass(object):
1427 def test_one(self):
1428 assert self.hello == "world"
1429 def test_two(self):
1430 assert self.hello == "world"
1431 """
1432 )
1433 reprec = pytester.inline_run()
1434 reprec.assertoutcome(passed=2)
1435
1436 def test_usefixtures_seen_in_showmarkers(self, pytester: Pytester) -> None:
1437 result = pytester.runpytest("--markers")

Callers

nothing calls this directly

Calls 5

assertoutcomeMethod · 0.80
makeiniMethod · 0.45
makeconftestMethod · 0.45
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected