diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2017-07-25 11:19:25 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-25 11:19:25 -0300 |
commit | 71947cb4f057155679209c7e72449ce0f18ab6dd (patch) | |
tree | 140467dccad50a597c7f781cc4e984327a8a697b | |
parent | 70d9f8638f95a8b4808f3ba6523cbce31db0c6c9 (diff) | |
parent | 72531f30c0d8834230f2007fe5b563c9fe5af04b (diff) | |
download | pytest-71947cb4f057155679209c7e72449ce0f18ab6dd.tar.gz |
Merge pull request #2546 from blueyed/better-skip-not-allowed-error
[RFC] Improve error message for CollectError with skip/skipif
-rw-r--r-- | _pytest/python.py | 7 | ||||
-rw-r--r-- | changelog/2546.trivial | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/_pytest/python.py b/_pytest/python.py index d0f13a758..29e3182d4 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -442,9 +442,10 @@ class Module(main.File, PyCollector): if e.allow_module_level: raise raise self.CollectError( - "Using pytest.skip outside of a test is not allowed. If you are " - "trying to decorate a test function, use the @pytest.mark.skip " - "or @pytest.mark.skipif decorators instead." + "Using pytest.skip outside of a test is not allowed. " + "To decorate a test function, use the @pytest.mark.skip " + "or @pytest.mark.skipif decorators instead, and to skip a " + "module use `pytestmark = pytest.mark.{skip,skipif}." ) self.config.pluginmanager.consider_module(mod) return mod diff --git a/changelog/2546.trivial b/changelog/2546.trivial new file mode 100644 index 000000000..53e43bc17 --- /dev/null +++ b/changelog/2546.trivial @@ -0,0 +1 @@ +Improve error message for CollectError with skip/skipif. |