Improve error message for CollectError with skip/skipif
This commit is contained in:
parent
70d9f8638f
commit
72531f30c0
|
@ -442,9 +442,10 @@ class Module(main.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 is not allowed. If you are "
|
"Using pytest.skip outside of a test is not allowed. "
|
||||||
"trying to decorate a test function, use the @pytest.mark.skip "
|
"To decorate a test function, use the @pytest.mark.skip "
|
||||||
"or @pytest.mark.skipif decorators instead."
|
"or @pytest.mark.skipif decorators instead, and to skip a "
|
||||||
|
"module use `pytestmark = pytest.mark.{skip,skipif}."
|
||||||
)
|
)
|
||||||
self.config.pluginmanager.consider_module(mod)
|
self.config.pluginmanager.consider_module(mod)
|
||||||
return mod
|
return mod
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Improve error message for CollectError with skip/skipif.
|
Loading…
Reference in New Issue