Improve error message when using pytest.skip at module level

As discussed in issue #1959.
This commit is contained in:
Nikolaus Rath 2016-09-26 21:07:46 -07:00 committed by Bruno Oliveira
parent a87b1c79c1
commit 57bb3c6922
1 changed files with 3 additions and 3 deletions

View File

@ -435,9 +435,9 @@ class Module(pytest.File, PyCollector):
if e.allow_module_level: if e.allow_module_level:
raise raise
raise self.CollectError( raise self.CollectError(
"Using @pytest.skip outside of a test (e.g. as a test " "Using pytest.skip outside of a test is not allowed. If you are "
"function decorator) is not allowed. Use @pytest.mark.skip or " "trying to decorate a test function, use the @pytest.mark.skip "
"@pytest.mark.skipif instead." "or @pytest.mark.skipif decorators instead."
) )
self.config.pluginmanager.consider_module(mod) self.config.pluginmanager.consider_module(mod)
return mod return mod