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

Method test_request_attributes

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

Source from the content-addressed store, hash-verified

647
648class TestRequestBasic:
649 def test_request_attributes(self, pytester: Pytester) -> None:
650 item = pytester.getitem(
651 """
652 import pytest
653
654 @pytest.fixture
655 def something(request): pass
656 def test_func(something): pass
657 """
658 )
659 assert isinstance(item, Function)
660 req = fixtures.FixtureRequest(item, _ispytest=True)
661 assert req.function == item.obj
662 assert req.keywords == item.keywords
663 assert hasattr(req.module, "test_func")
664 assert req.cls is None
665 assert req.function.__name__ == "test_func"
666 assert req.config == item.config
667 assert repr(req).find(req.function.__name__) != -1
668
669 def test_request_attributes_method(self, pytester: Pytester) -> None:
670 (item,) = pytester.getitems(

Callers

nothing calls this directly

Calls 1

getitemMethod · 0.45

Tested by

no test coverage detected