Always use getfixturemarker() to access _pytestfixturefunction

Keep knowledge of how the marker is stored encapsulated in one place.
This commit is contained in:
Ran Benita
2020-11-26 14:50:44 +02:00
parent ade253c790
commit 8ee6d0a866
2 changed files with 18 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ from typing import Any
import pytest
from _pytest import runner
from _pytest._code import getfslineno
from _pytest.fixtures import getfixturemarker
from _pytest.pytester import Pytester
@@ -334,7 +335,8 @@ class TestReRunTests:
def test_pytestconfig_is_session_scoped() -> None:
from _pytest.fixtures import pytestconfig
marker = pytestconfig._pytestfixturefunction # type: ignore
marker = getfixturemarker(pytestconfig)
assert marker is not None
assert marker.scope == "session"