diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-03-04 11:56:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 11:56:21 +0100 |
commit | c14a9adba35ac675ce3e825d34d01d5bb51748c3 (patch) | |
tree | 254952864d53740d842a016e6cfb0c416f7a8e26 /src | |
parent | 4dbb29431ae38b6906c6ca254b4ed18cad7b5f7e (diff) | |
download | pytest-c14a9adba35ac675ce3e825d34d01d5bb51748c3.tar.gz |
Fix skip signature (#8392)
* Fix test_strict_and_skip
The `--strict` argument was removed in #2552, but the removal wasn't
actually correct - see #1472.
* Fix argument handling in pytest.mark.skip
See #8384
* Raise from None
* Fix test name
Diffstat (limited to 'src')
-rw-r--r-- | src/_pytest/skipping.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/_pytest/skipping.py b/src/_pytest/skipping.py index 1ad312919..7fe9783a4 100644 --- a/src/_pytest/skipping.py +++ b/src/_pytest/skipping.py @@ -161,7 +161,7 @@ def evaluate_condition(item: Item, mark: Mark, condition: object) -> Tuple[bool, class Skip: """The result of evaluate_skip_marks().""" - reason = attr.ib(type=str) + reason = attr.ib(type=str, default="unconditional skip") def evaluate_skip_marks(item: Item) -> Optional[Skip]: @@ -184,13 +184,10 @@ def evaluate_skip_marks(item: Item) -> Optional[Skip]: return Skip(reason) for mark in item.iter_markers(name="skip"): - if "reason" in mark.kwargs: - reason = mark.kwargs["reason"] - elif mark.args: - reason = mark.args[0] - else: - reason = "unconditional skip" - return Skip(reason) + try: + return Skip(*mark.args, **mark.kwargs) + except TypeError as e: + raise TypeError(str(e) + " - maybe you meant pytest.mark.skipif?") from None return None |