Deprecation of msg= for both pytest.skip() and pytest.fail(). (#8950)
* porting pytest.skip() to use reason=, adding tests * avoid adding **kwargs, it breaks other functionality, use optional msg= instead * deprecation of `pytest.fail(msg=...)` * fix bug with not capturing the returned reason value * pass reason= in acceptance async tests instead of msg= * finalising deprecations of `msg` in `pytest.skip()` and `pytest.fail()` * Update doc/en/deprecations.rst Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com> * Update doc/en/deprecations.rst Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com> * fix failing test after upstream merge * adding deprecation to `pytest.exit(msg=...)` * add docs for pytest.exit deprecations * finalising deprecation of msg for pytest.skip, pytest.exit and pytest.fail * hold a reference to the Scope instance to please mypy Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
@@ -71,7 +71,8 @@ class Scope(Enum):
|
||||
from _pytest.outcomes import fail
|
||||
|
||||
try:
|
||||
return Scope(scope_name)
|
||||
# Holding this reference is necessary for mypy at the moment.
|
||||
scope = Scope(scope_name)
|
||||
except ValueError:
|
||||
fail(
|
||||
"{} {}got an unexpected scope value '{}'".format(
|
||||
@@ -79,6 +80,7 @@ class Scope(Enum):
|
||||
),
|
||||
pytrace=False,
|
||||
)
|
||||
return scope
|
||||
|
||||
|
||||
_ALL_SCOPES = list(Scope)
|
||||
|
||||
Reference in New Issue
Block a user