Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Apr 2, 2021
1 parent 03e78ff commit 91661a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
10 changes: 2 additions & 8 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,7 @@ def _try_load_conftest(

@lru_cache(maxsize=128)
def _getconftestmodules(
self,
path: Path,
importmode: Union[str, ImportMode],
rootpath: Path
self, path: Path, importmode: Union[str, ImportMode], rootpath: Path
) -> List[types.ModuleType]:
if self._noconftest:
return []
Expand Down Expand Up @@ -569,10 +566,7 @@ def _rget_with_confmod(
raise KeyError(name)

def _importconftest(
self,
conftestpath: Path,
importmode: Union[str, ImportMode],
rootpath: Path
self, conftestpath: Path, importmode: Union[str, ImportMode], rootpath: Path
) -> types.ModuleType:
# Use a resolved Path object as key to avoid loading the same conftest
# twice with build systems that create build directories containing
Expand Down
4 changes: 3 additions & 1 deletion src/_pytest/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ def _find(

if self.path.name == "conftest.py":
module = self.config.pluginmanager._importconftest(
self.path, self.config.getoption("importmode"), rootpath=self.config.rootpath
self.path,
self.config.getoption("importmode"),
rootpath=self.config.rootpath,
)
else:
try:
Expand Down
4 changes: 3 additions & 1 deletion src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ def _in_venv(path: Path) -> bool:


def pytest_ignore_collect(fspath: Path, config: Config) -> Optional[bool]:
ignore_paths = config._getconftest_pathlist("collect_ignore", path=fspath.parent, rootpath=config.rootpath)
ignore_paths = config._getconftest_pathlist(
"collect_ignore", path=fspath.parent, rootpath=config.rootpath
)
ignore_paths = ignore_paths or []
excludeopt = config.getoption("ignore")
if excludeopt:
Expand Down
8 changes: 1 addition & 7 deletions testing/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,7 @@ def test_invalid_path(self, tmp_path: Path) -> None:
def simple_module(self, tmp_path: Path) -> Path:
fn = tmp_path / "_src/tests/mymod.py"
fn.parent.mkdir(parents=True)
fn.write_text(
dedent(
"""
def foo(x): return 40 + x
"""
)
)
fn.write_text("def foo(x): return 40 + x")
return fn

def test_importmode_importlib(self, simple_module: Path, tmp_path: Path) -> None:
Expand Down

0 comments on commit 91661a0

Please sign in to comment.