typing: minor improvements
This commit is contained in:
parent
d7d5cf4136
commit
bc7282576f
|
@ -36,6 +36,7 @@ if False: # TYPE_CHECKING
|
|||
from typing import Type
|
||||
|
||||
from _pytest import nodes
|
||||
from _pytest.main import Session
|
||||
|
||||
|
||||
@attr.s(frozen=True)
|
||||
|
@ -44,7 +45,7 @@ class PseudoFixtureDef:
|
|||
scope = attr.ib()
|
||||
|
||||
|
||||
def pytest_sessionstart(session):
|
||||
def pytest_sessionstart(session: "Session"):
|
||||
import _pytest.python
|
||||
import _pytest.nodes
|
||||
|
||||
|
@ -510,13 +511,11 @@ class FixtureRequest:
|
|||
values.append(fixturedef)
|
||||
current = current._parent_request
|
||||
|
||||
def _compute_fixture_value(self, fixturedef):
|
||||
def _compute_fixture_value(self, fixturedef: "FixtureDef") -> None:
|
||||
"""
|
||||
Creates a SubRequest based on "self" and calls the execute method of the given fixturedef object. This will
|
||||
force the FixtureDef object to throw away any previous results and compute a new fixture value, which
|
||||
will be stored into the FixtureDef object itself.
|
||||
|
||||
:param FixtureDef fixturedef:
|
||||
"""
|
||||
# prepare a subrequest object before calling fixture function
|
||||
# (latter managed by fixturedef)
|
||||
|
@ -544,9 +543,8 @@ class FixtureRequest:
|
|||
if has_params:
|
||||
frame = inspect.stack()[3]
|
||||
frameinfo = inspect.getframeinfo(frame[0])
|
||||
source_path = frameinfo.filename
|
||||
source_path = py.path.local(frameinfo.filename)
|
||||
source_lineno = frameinfo.lineno
|
||||
source_path = py.path.local(source_path)
|
||||
if source_path.relto(funcitem.config.rootdir):
|
||||
source_path = source_path.relto(funcitem.config.rootdir)
|
||||
msg = (
|
||||
|
|
|
@ -15,6 +15,7 @@ from _pytest import nodes
|
|||
from _pytest.config import directory_arg
|
||||
from _pytest.config import hookimpl
|
||||
from _pytest.config import UsageError
|
||||
from _pytest.fixtures import FixtureManager
|
||||
from _pytest.outcomes import exit
|
||||
from _pytest.runner import collect_one_node
|
||||
from _pytest.runner import SetupState
|
||||
|
@ -372,6 +373,7 @@ class Session(nodes.FSCollector):
|
|||
Interrupted = Interrupted
|
||||
Failed = Failed
|
||||
_setupstate = None # type: SetupState
|
||||
_fixturemanager = None # type: FixtureManager
|
||||
|
||||
def __init__(self, config):
|
||||
nodes.FSCollector.__init__(
|
||||
|
|
Loading…
Reference in New Issue