Update error message for module level skip to include 'allow_module_level' (#8906)
Co-authored-by: Naveen <NaveenPr1@microland.com> Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
@@ -608,10 +608,10 @@ class Module(nodes.File, PyCollector):
|
||||
if e.allow_module_level:
|
||||
raise
|
||||
raise self.CollectError(
|
||||
"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}."
|
||||
"Using pytest.skip outside of a test will skip the entire module. "
|
||||
"If that's your intention, pass `allow_module_level=True`. "
|
||||
"If you want to skip a specific test or an entire class, "
|
||||
"use the @pytest.mark.skip or @pytest.mark.skipif decorators."
|
||||
) from e
|
||||
self.config.pluginmanager.consider_module(mod)
|
||||
return mod
|
||||
|
||||
Reference in New Issue
Block a user