From 5f83069d86f394a36179013132f99024f8f6e85d Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sun, 19 Feb 2023 22:54:37 +0100 Subject: [PATCH 1/5] docs: be more explicit about module level skip preventing collection --- changelog/10753.doc.rst | 2 ++ src/_pytest/outcomes.py | 7 +++++-- 2 files changed, 7 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 2a998e421ea..66b44ea7c90 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -157,8 +157,11 @@ 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 in a module will stop the execution of the module. + Additionally, the module will no longer be collected. + + Defaults to False. :param msg: Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead. From 2a832f09ffc0a15758dc5e506e6c9810cac59ef3 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 20 Feb 2023 07:33:06 +0100 Subject: [PATCH 2/5] fixup: even more explicit about module skip preventing collect --- src/_pytest/outcomes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index 66b44ea7c90..47d1719beda 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -158,8 +158,8 @@ def skip( :param allow_module_level: Allows this function to be called at module level. - Raising the skip exception in a module will stop the execution of the module. - Additionally, the module will no longer be collected. + Raising the skip exception at module level will stop + the execution of the module and prevent its collection. alltogether. Defaults to False. From ebad6143957f06563333f1d7c49ba821cc5a599a Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 28 Feb 2023 15:50:42 +0100 Subject: [PATCH 3/5] Update src/_pytest/outcomes.py Co-authored-by: Bruno Oliveira --- src/_pytest/outcomes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index 47d1719beda..95552616e31 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -159,7 +159,7 @@ def skip( :param allow_module_level: 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 its collection. alltogether. + 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. From 8c92a36d4d48e627bff743180374438b24ecd0dc Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 28 Feb 2023 12:04:22 -0300 Subject: [PATCH 4/5] Update src/_pytest/outcomes.py --- src/_pytest/outcomes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index 95552616e31..dcb2ee5695a 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -159,7 +159,8 @@ def skip( :param allow_module_level: 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. + 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. From 299902efc1be0471643490c6dd664ea2e119a983 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:05:45 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_pytest/outcomes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py index dcb2ee5695a..1be97dda4ea 100644 --- a/src/_pytest/outcomes.py +++ b/src/_pytest/outcomes.py @@ -159,7 +159,7 @@ def skip( :param allow_module_level: 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, + 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.