Skip to content

Commit

Permalink
typing: minor: _pytest.assertion.rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Mar 17, 2020
1 parent 705a875 commit ca176dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/_pytest/assertion/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
format_explanation as _format_explanation,
)
from _pytest.compat import fspath
from _pytest.config import Config
from _pytest.pathlib import fnmatch_ex
from _pytest.pathlib import Path
from _pytest.pathlib import PurePath
Expand All @@ -40,7 +41,7 @@
class AssertionRewritingHook(importlib.abc.MetaPathFinder):
"""PEP302/PEP451 import hook which rewrites asserts."""

def __init__(self, config):
def __init__(self, config: Config) -> None:
self.config = config
try:
self.fnpats = config.getini("python_files")
Expand Down Expand Up @@ -205,7 +206,7 @@ def _should_rewrite(self, name, fn, state):

return self._is_marked_for_rewrite(name, state)

def _is_marked_for_rewrite(self, name: str, state):
def _is_marked_for_rewrite(self, name: str, state) -> bool:
try:
return self._marked_for_rewrite_cache[name]
except KeyError:
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ def _consider_importhook(self, args: Sequence[str]) -> None:
self._mark_plugins_for_rewrite(hook)
_warn_about_missing_assertion(mode)

def _mark_plugins_for_rewrite(self, hook):
def _mark_plugins_for_rewrite(self, hook) -> None:
"""
Given an importhook, mark for rewrite any top-level
modules or packages in the distribution package for
Expand Down

0 comments on commit ca176dc

Please sign in to comment.