From 57bb3c6922ec32dcc7af17029eed357ed0742546 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Mon, 26 Sep 2016 21:07:46 -0700 Subject: [PATCH 1/2] Improve error message when using pytest.skip at module level As discussed in issue #1959. --- _pytest/python.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_pytest/python.py b/_pytest/python.py index eacea994d9b..548d7cfa52a 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -435,9 +435,9 @@ def _importtestmodule(self): if e.allow_module_level: raise raise self.CollectError( - "Using @pytest.skip outside of a test (e.g. as a test " - "function decorator) is not allowed. Use @pytest.mark.skip or " - "@pytest.mark.skipif instead." + "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." ) self.config.pluginmanager.consider_module(mod) return mod From 336d7900c587caa35c0bb9067bf6820fe66a89ea Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 1 Oct 2016 13:38:41 -0300 Subject: [PATCH 2/2] Fix test about pytest.skip message being used at global level Fix #1959 --- testing/test_skipping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 12b18ca3300..2e7868d3ab8 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -967,5 +967,5 @@ def test_func(): """) result = testdir.runpytest() result.stdout.fnmatch_lines( - "*Using @pytest.skip outside of a test * is not allowed*" + "*Using pytest.skip outside of a test is not allowed*" )