Skip to content

Commit ae5d16b

Browse files
bluetechblueyed
authored andcommitted
typing: FSHookProxy/gethookproxy
Taken out of #6556.
1 parent e2934c3 commit ae5d16b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/_pytest/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def pytest_runtest_logreport(self, report):
436436
def isinitpath(self, path):
437437
return path in self._initialpaths
438438

439-
def gethookproxy(self, fspath):
439+
def gethookproxy(self, fspath: py.path.local):
440440
return super()._gethookproxy(fspath)
441441

442442
def perform_collect(self, args=None, genitems=True):

src/_pytest/nodes.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from _pytest.compat import getfslineno
2020
from _pytest.compat import TYPE_CHECKING
2121
from _pytest.config import Config
22+
from _pytest.config import PytestPluginManager
2223
from _pytest.fixtures import FixtureDef
2324
from _pytest.fixtures import FixtureLookupError
2425
from _pytest.fixtures import FixtureLookupErrorRepr
@@ -394,12 +395,14 @@ def _check_initialpaths_for_relpath(session, fspath):
394395

395396

396397
class FSHookProxy:
397-
def __init__(self, fspath, pm, remove_mods):
398+
def __init__(
399+
self, fspath: py.path.local, pm: PytestPluginManager, remove_mods
400+
) -> None:
398401
self.fspath = fspath
399402
self.pm = pm
400403
self.remove_mods = remove_mods
401404

402-
def __getattr__(self, name):
405+
def __getattr__(self, name: str):
403406
x = self.pm.subset_hook_caller(name, remove_plugins=self.remove_mods)
404407
self.__dict__[name] = x
405408
return x
@@ -431,7 +434,7 @@ def __init__(
431434

432435
self._norecursepatterns = self.config.getini("norecursedirs")
433436

434-
def _gethookproxy(self, fspath):
437+
def _gethookproxy(self, fspath: py.path.local):
435438
# check if we have the common case of running
436439
# hooks with all conftest.py files
437440
pm = self.config.pluginmanager

src/_pytest/python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ def setup(self):
578578
func = partial(_call_with_optional_argument, teardown_module, self.obj)
579579
self.addfinalizer(func)
580580

581-
def gethookproxy(self, fspath):
581+
def gethookproxy(self, fspath: py.path.local):
582582
return super()._gethookproxy(fspath)
583583

584584
def _collectfile(self, path, handle_dupes=True):

0 commit comments

Comments
 (0)