(self, pytester: Pytester)
| 807 | result.stdout.fnmatch_lines(["* 2 passed in *"]) |
| 808 | |
| 809 | def test_getfixturevalue(self, pytester: Pytester) -> None: |
| 810 | item = pytester.getitem( |
| 811 | """ |
| 812 | import pytest |
| 813 | |
| 814 | @pytest.fixture |
| 815 | def something(request): |
| 816 | return 1 |
| 817 | |
| 818 | values = [2] |
| 819 | @pytest.fixture |
| 820 | def other(request): |
| 821 | return values.pop() |
| 822 | |
| 823 | def test_func(something): pass |
| 824 | """ |
| 825 | ) |
| 826 | assert isinstance(item, Function) |
| 827 | req = item._request |
| 828 | |
| 829 | # Execute item's setup. |
| 830 | item.session._setupstate.setup(item) |
| 831 | |
| 832 | with pytest.raises(pytest.FixtureLookupError): |
| 833 | req.getfixturevalue("notexists") |
| 834 | val = req.getfixturevalue("something") |
| 835 | assert val == 1 |
| 836 | val = req.getfixturevalue("something") |
| 837 | assert val == 1 |
| 838 | val2 = req.getfixturevalue("other") |
| 839 | assert val2 == 2 |
| 840 | val2 = req.getfixturevalue("other") # see about caching |
| 841 | assert val2 == 2 |
| 842 | assert item.funcargs["something"] == 1 |
| 843 | assert len(get_public_names(item.funcargs)) == 2 |
| 844 | assert "request" in item.funcargs |
| 845 | |
| 846 | def test_request_addfinalizer(self, pytester: Pytester) -> None: |
| 847 | item = pytester.getitem( |
nothing calls this directly
no test coverage detected