Merge pull request #1975 from nicoddemus/pytest-skip-message

Pytest skip message
This commit is contained in:
Bruno Oliveira 2016-10-01 14:44:49 -03:00 committed by GitHub
commit fc02003220
2 changed files with 4 additions and 4 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

View File

@ -967,5 +967,5 @@ def test_module_level_skip_error(testdir):
""") """)
result = testdir.runpytest() result = testdir.runpytest()
result.stdout.fnmatch_lines( result.stdout.fnmatch_lines(
"*Using @pytest.skip outside of a test * is not allowed*" "*Using pytest.skip outside of a test is not allowed*"
) )