Fix non-sensical error message (#9077)

* Fix non-sensical error message

Introduced in 12de92cd2b / #7698

* Add a test

* Put the unit back into unittest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Florian Bruhin
2021-09-24 06:15:53 +02:00
committed by GitHub
parent 037d2903be
commit 112204cf8d
3 changed files with 17 additions and 1 deletions

View File

@@ -1093,6 +1093,21 @@ class TestRequestBasic:
reprec.assertoutcome(passed=2)
class TestRequestSessionScoped:
@pytest.fixture(scope="session")
def session_request(self, request):
return request
@pytest.mark.parametrize("name", ["path", "fspath", "module"])
def test_session_scoped_unavailable_attributes(self, session_request, name):
expected = "path" if name == "fspath" else name
with pytest.raises(
AttributeError,
match=f"{expected} not available in session-scoped context",
):
getattr(session_request, name)
class TestRequestMarking:
def test_applymarker(self, pytester: Pytester) -> None:
item1, item2 = pytester.getitems(