(self, pytester: Pytester)
| 981 | ) |
| 982 | |
| 983 | def test_getfixturevalue(self, pytester: Pytester) -> None: |
| 984 | item = pytester.getitem( |
| 985 | """ |
| 986 | import pytest |
| 987 | |
| 988 | @pytest.fixture |
| 989 | def something(request): |
| 990 | return 1 |
| 991 | |
| 992 | values = [2] |
| 993 | @pytest.fixture |
| 994 | def other(request): |
| 995 | return values.pop() |
| 996 | |
| 997 | def test_func(something): pass |
| 998 | """ |
| 999 | ) |
| 1000 | assert isinstance(item, Function) |
| 1001 | req = item._request |
| 1002 | |
| 1003 | # Execute item's setup. |
| 1004 | item.session._setupstate.setup(item) |
| 1005 | |
| 1006 | with pytest.raises(pytest.FixtureLookupError): |
| 1007 | req.getfixturevalue("notexists") |
| 1008 | val = req.getfixturevalue("something") |
| 1009 | assert val == 1 |
| 1010 | val = req.getfixturevalue("something") |
| 1011 | assert val == 1 |
| 1012 | val2 = req.getfixturevalue("other") |
| 1013 | assert val2 == 2 |
| 1014 | val2 = req.getfixturevalue("other") # see about caching |
| 1015 | assert val2 == 2 |
| 1016 | assert item.funcargs["something"] == 1 |
| 1017 | assert len(get_public_names(item.funcargs)) == 2 |
| 1018 | assert "request" in item.funcargs |
| 1019 | |
| 1020 | def test_request_addfinalizer(self, pytester: Pytester) -> None: |
| 1021 | item = pytester.getitem( |
nothing calls this directly
no test coverage detected