From 2fd4549db50e0086ce163654c8e060478111f05a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:03:47 +0000 Subject: [PATCH] [7.2.x] docs: be more explicit about module level skip preventing collection (#10777) Co-authored-by: Ronny Pfannschmidt --- changelog/10753.doc.rst | 2 ++ src/_pytest/outcomes.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelog/10753.doc.rst diff --git a/changelog/10753.doc.rst b/changelog/10753.doc.rst new file mode 100644 index 00000000000..701d81a7c2c --- /dev/null +++ b/changelog/10753.doc.rst @@ -0,0 +1,2 @@ +Change wording of the module level skip to be very explicit +about not collecting and not executing the rest of the module. diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index e46b663dd50..3efd1de7fbb 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -157,8 +157,12 @@ def skip( The message to show the user as reason for the skip. :param allow_module_level: - Allows this function to be called at module level, skipping the rest - of the module. Defaults to False. + Allows this function to be called at module level. + Raising the skip exception at module level will stop + the execution of the module and prevent the collection of all tests in the module, + even those defined before the `skip` call. + + Defaults to False. :param msg: Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.