MCPcopy
hub / github.com/pytest-dev/pytest / test_request_attributes

Method test_request_attributes

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

Source from the content-addressed store, hash-verified

713
714class TestRequestBasic:
715 def test_request_attributes(self, pytester: Pytester) -> None:
716 item = pytester.getitem(
717 """
718 import pytest
719
720 @pytest.fixture
721 def something(request): pass
722 def test_func(something): pass
723 """
724 )
725 assert isinstance(item, Function)
726 req = TopRequest(item, _ispytest=True)
727 assert req.function == item.obj
728 assert req.keywords == item.keywords
729 assert hasattr(req.module, "test_func")
730 assert req.cls is None
731 assert req.function.__name__ == "test_func"
732 assert req.config == item.config
733 assert repr(req).find(req.function.__name__) != -1
734
735 def test_request_attributes_method(self, pytester: Pytester) -> None:
736 (item,) = pytester.getitems(

Callers

nothing calls this directly

Calls 2

TopRequestClass · 0.90
getitemMethod · 0.45

Tested by

no test coverage detected