Skip to content

Commit

Permalink
Add hint of Issue pytest-dev#478 to error text
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncan Betts committed Nov 26, 2016
1 parent 33796c8 commit c1b83cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ David Mohr
David Vierra
Diego Russo
Dmitry Dygalo
Duncan Betts
Edison Gustavo Muenz
Edoardo Batini
Eduardo Schettino
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
3.0.5.dev0
==========

*
* Add hint to error message hinting possible missing __init__.py (`#478`_). Thanks `@DuncanBetts`_.

* An error message is now displayed if ``--confcutdir`` is not a valid directory, avoiding
subtle bugs (`#2078`_).
Expand All @@ -20,8 +20,10 @@
*

.. _@adler-j: https://github.com/adler-j
.. _@DuncanBetts: https://github.com/DuncanBetts
.. _@nedbat: https://github.com/nedbat

.. _#478: https://github.com/pytest-dev/pytest/issues/478
.. _#2038: https://github.com/pytest-dev/pytest/issues/2038
.. _#2078: https://github.com/pytest-dev/pytest/issues/2078
.. _#2082: https://github.com/pytest-dev/pytest/issues/2082
Expand Down
5 changes: 2 additions & 3 deletions _pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,9 @@ def _parsearg(self, arg):
path = self.config.invocation_dir.join(relpath, abs=True)
if not path.check():
if self.config.option.pyargs:
msg = "file or package not found: "
raise pytest.UsageError("file or package not found: " + arg + " (missing __init__.py?)")
else:
msg = "file not found: "
raise pytest.UsageError(msg + arg)
raise pytest.UsageError("file not found: " + arg)
parts[0] = path
return parts

Expand Down

0 comments on commit c1b83cd

Please sign in to comment.