Skip to content

Commit 47ae1fb

Browse files
authored
Merge pull request #6271 from blueyed/typing
typing: minor improvements
2 parents d7d5cf4 + bc72825 commit 47ae1fb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/_pytest/fixtures.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from typing import Type
3737

3838
from _pytest import nodes
39+
from _pytest.main import Session
3940

4041

4142
@attr.s(frozen=True)
@@ -44,7 +45,7 @@ class PseudoFixtureDef:
4445
scope = attr.ib()
4546

4647

47-
def pytest_sessionstart(session):
48+
def pytest_sessionstart(session: "Session"):
4849
import _pytest.python
4950
import _pytest.nodes
5051

@@ -510,13 +511,11 @@ def _get_fixturestack(self):
510511
values.append(fixturedef)
511512
current = current._parent_request
512513

513-
def _compute_fixture_value(self, fixturedef):
514+
def _compute_fixture_value(self, fixturedef: "FixtureDef") -> None:
514515
"""
515516
Creates a SubRequest based on "self" and calls the execute method of the given fixturedef object. This will
516517
force the FixtureDef object to throw away any previous results and compute a new fixture value, which
517518
will be stored into the FixtureDef object itself.
518-
519-
:param FixtureDef fixturedef:
520519
"""
521520
# prepare a subrequest object before calling fixture function
522521
# (latter managed by fixturedef)
@@ -544,9 +543,8 @@ def _compute_fixture_value(self, fixturedef):
544543
if has_params:
545544
frame = inspect.stack()[3]
546545
frameinfo = inspect.getframeinfo(frame[0])
547-
source_path = frameinfo.filename
546+
source_path = py.path.local(frameinfo.filename)
548547
source_lineno = frameinfo.lineno
549-
source_path = py.path.local(source_path)
550548
if source_path.relto(funcitem.config.rootdir):
551549
source_path = source_path.relto(funcitem.config.rootdir)
552550
msg = (

src/_pytest/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from _pytest.config import directory_arg
1616
from _pytest.config import hookimpl
1717
from _pytest.config import UsageError
18+
from _pytest.fixtures import FixtureManager
1819
from _pytest.outcomes import exit
1920
from _pytest.runner import collect_one_node
2021
from _pytest.runner import SetupState
@@ -372,6 +373,7 @@ class Session(nodes.FSCollector):
372373
Interrupted = Interrupted
373374
Failed = Failed
374375
_setupstate = None # type: SetupState
376+
_fixturemanager = None # type: FixtureManager
375377

376378
def __init__(self, config):
377379
nodes.FSCollector.__init__(

0 commit comments

Comments
 (0)