Skip to content

Commit

Permalink
collectfile: improve assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Feb 13, 2019
1 parent 9e9a3a7 commit 3fb411b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,12 @@ def _collect(self, arg):
yield y

def _collectfile(self, path, handle_dupes=True):
assert path.isfile()
assert path.isfile(), "%r is not a file (isdir=%r, exists=%r, islink=%r)" % (
path,
path.isdir(),
path.exists(),
path.islink(),
)
ihook = self.gethookproxy(path)
if not self.isinitpath(path):
if ihook.pytest_ignore_collect(path=path, config=self.config):
Expand Down
7 changes: 6 additions & 1 deletion src/_pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,12 @@ def gethookproxy(self, fspath):
return proxy

def _collectfile(self, path, handle_dupes=True):
assert path.isfile()
assert path.isfile(), "%r is not a file (isdir=%r, exists=%r, islink=%r)" % (
path,
path.isdir(),
path.exists(),
path.islink(),
)
ihook = self.gethookproxy(path)
if not self.isinitpath(path):
if ihook.pytest_ignore_collect(path=path, config=self.config):
Expand Down

0 comments on commit 3fb411b

Please sign in to comment.