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

Method test_usefixtures_marker

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

Source from the content-addressed store, hash-verified

1380 assert len(values) == 1
1381
1382 def test_usefixtures_marker(self, pytester: Pytester) -> None:
1383 pytester.makepyfile(
1384 """
1385 import pytest
1386
1387 values = []
1388
1389 @pytest.fixture(scope="class")
1390 def myfix(request):
1391 request.cls.hello = "world"
1392 values.append(1)
1393
1394 class TestClass(object):
1395 def test_one(self):
1396 assert self.hello == "world"
1397 assert len(values) == 1
1398 def test_two(self):
1399 assert self.hello == "world"
1400 assert len(values) == 1
1401 pytest.mark.usefixtures("myfix")(TestClass)
1402 """
1403 )
1404 reprec = pytester.inline_run()
1405 reprec.assertoutcome(passed=2)
1406
1407 def test_usefixtures_ini(self, pytester: Pytester) -> None:
1408 pytester.makeini(

Callers

nothing calls this directly

Calls 3

assertoutcomeMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected