From c1b83cdeea9763635bc182ab7f8c94aae3d4c4ad Mon Sep 17 00:00:00 2001 From: Duncan Betts Date: Sat, 26 Nov 2016 10:47:15 +0000 Subject: [PATCH] Add hint of Issue #478 to error text --- AUTHORS | 1 + CHANGELOG.rst | 4 +++- _pytest/main.py | 5 ++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 8cc6824cd95..e966139bec3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -44,6 +44,7 @@ David Mohr David Vierra Diego Russo Dmitry Dygalo +Duncan Betts Edison Gustavo Muenz Edoardo Batini Eduardo Schettino diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f97ff3787b9..40797c30c6e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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`_). @@ -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 diff --git a/_pytest/main.py b/_pytest/main.py index 5771a169999..dd0775501a1 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -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