Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Dec 19, 2020
1 parent a2aa292 commit 173fd6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/_pytest/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ def _find(

if self.fspath.basename == "conftest.py":
module = self.config.pluginmanager._importconftest(
Path(self.fspath), self.config.getoption("importmode"),rootpath=self.config.rootpath
Path(self.fspath),
self.config.getoption("importmode"),
rootpath=self.config.rootpath,
)
else:
try:
Expand Down
8 changes: 6 additions & 2 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ def _in_venv(path: py.path.local) -> bool:

def pytest_ignore_collect(path: py.path.local, config: Config) -> Optional[bool]:
path_ = Path(path)
ignore_paths = config._getconftest_pathlist("collect_ignore", path=path_.parent, rootpath=config.rootpath)
ignore_paths = config._getconftest_pathlist(
"collect_ignore", path=path_.parent, rootpath=config.rootpath
)
ignore_paths = ignore_paths or []
excludeopt = config.getoption("ignore")
if excludeopt:
Expand Down Expand Up @@ -518,7 +520,9 @@ def gethookproxy(self, fspath: "os.PathLike[str]"):
# hooks with all conftest.py files.
pm = self.config.pluginmanager
my_conftestmodules = pm._getconftestmodules(
Path(fspath), self.config.getoption("importmode"), rootpath=self.config.rootpath
Path(fspath),
self.config.getoption("importmode"),
rootpath=self.config.rootpath,
)
remove_mods = pm._conftest_plugins.difference(my_conftestmodules)
if remove_mods:
Expand Down
10 changes: 8 additions & 2 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,14 @@ def test_getconftest_pathlist(self, pytester: Pytester, tmp_path: Path) -> None:
p = tmp_path.joinpath("conftest.py")
p.write_text(f"pathlist = ['.', {str(somepath)!r}]")
config = pytester.parseconfigure(p)
assert config._getconftest_pathlist("notexist", path=tmp_path, rootpath=tmp_path) is None
pl = config._getconftest_pathlist("pathlist", path=tmp_path, rootpath=tmp_path) or []
assert (
config._getconftest_pathlist("notexist", path=tmp_path, rootpath=tmp_path)
is None
)
pl = (
config._getconftest_pathlist("pathlist", path=tmp_path, rootpath=tmp_path)
or []
)
print(pl)
assert len(pl) == 2
assert pl[0] == tmp_path
Expand Down

0 comments on commit 173fd6e

Please sign in to comment.