-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove deprecated features #7660
Merged
nicoddemus
merged 11 commits into
pytest-dev:master
from
nicoddemus:deprecated-features
Aug 19, 2020
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9853018
Remove funcargnames compatibility property
nicoddemus c747dc5
Drop support for positional arguments in @pytest.fixture
nicoddemus 73e0637
Hard failure when constructing Node subclasses
nicoddemus 6ecbd00
Change junit_family default to xunit2
nicoddemus 345a59d
Add note about pytest.collect deprecation
nicoddemus 457d351
Remove deprecated TerminalReporter.writer property
nicoddemus 52b0cc4
Remove broken pytest_collect_directory hook
nicoddemus b32c48e
Add bottom changelog deprecation notice
nicoddemus ef946d5
Remove resultlog plugin
nicoddemus 7605150
Move --no-print-logs removal notice to 'Removed Features'
nicoddemus 372a094
PytestDeprecationWarning no longer a hard error
nicoddemus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
As per our policy, the following features have been deprecated in the 5.X series and are now | ||
removed: | ||
|
||
* The ``funcargnames`` read-only property of ``FixtureRequest``, ``Metafunc``, and ``Function`` classes. Use ``fixturenames`` attribute. | ||
|
||
* ``@pytest.fixture`` no longer supports positional arguments, pass all arguments by keyword instead. | ||
|
||
* Direct construction of ``Node`` subclasses now raise an error, use ``from_parent`` instead. | ||
|
||
* The default value for ``junit_family`` has changed to ``xunit2``. If you require the old format, add ``junit_family=xunit1`` to your configuration file. | ||
|
||
* The ``TerminalReporter`` no longer has a ``writer`` attribute. Plugin authors may use the public functions of the ``TerminalReporter`` instead of accessing the ``TerminalWriter`` object directly. | ||
|
||
* The ``--result-log`` option has been removed. Users are recommended to use the `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin instead. | ||
|
||
|
||
For more information consult | ||
`Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ in the docs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
import inspect | ||
import os | ||
import sys | ||
import warnings | ||
from collections import defaultdict | ||
from collections import deque | ||
from types import TracebackType | ||
|
@@ -46,8 +45,6 @@ | |
from _pytest.config import _PluggyPlugin | ||
from _pytest.config import Config | ||
from _pytest.config.argparsing import Parser | ||
from _pytest.deprecated import FIXTURE_POSITIONAL_ARGUMENTS | ||
from _pytest.deprecated import FUNCARGNAMES | ||
from _pytest.mark import ParameterSet | ||
from _pytest.outcomes import fail | ||
from _pytest.outcomes import TEST_OUTCOME | ||
|
@@ -457,12 +454,6 @@ def fixturenames(self) -> List[str]: | |
result.extend(set(self._fixture_defs).difference(result)) | ||
return result | ||
|
||
@property | ||
def funcargnames(self) -> List[str]: | ||
"""Alias attribute for ``fixturenames`` for pre-2.3 compatibility.""" | ||
warnings.warn(FUNCARGNAMES, stacklevel=2) | ||
return self.fixturenames | ||
|
||
@property | ||
def node(self): | ||
"""Underlying collection node (depends on current request scope).""" | ||
|
@@ -1253,7 +1244,7 @@ def fixture( # noqa: F811 | |
|
||
def fixture( # noqa: F811 | ||
fixture_function: Optional[_FixtureFunction] = None, | ||
*args: Any, | ||
*, | ||
scope: "Union[_Scope, Callable[[str, Config], _Scope]]" = "function", | ||
params: Optional[Iterable[object]] = None, | ||
autouse: bool = False, | ||
|
@@ -1315,53 +1306,6 @@ def fixture( # noqa: F811 | |
name the decorated function ``fixture_<fixturename>`` and then use | ||
``@pytest.fixture(name='<fixturename>')``. | ||
""" | ||
# Positional arguments backward compatibility. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
# If a kwarg is equal to its default, assume it was not explicitly | ||
# passed, i.e. not duplicated. The more correct way is to use a | ||
# **kwargs and check `in`, but that obfuscates the function signature. | ||
if isinstance(fixture_function, str): | ||
# It's actually the first positional argument, scope. | ||
args = (fixture_function, *args) # type: ignore[unreachable] | ||
fixture_function = None | ||
duplicated_args = [] | ||
if len(args) > 0: | ||
if scope == "function": | ||
scope = args[0] | ||
else: | ||
duplicated_args.append("scope") | ||
if len(args) > 1: | ||
if params is None: | ||
params = args[1] | ||
else: | ||
duplicated_args.append("params") | ||
if len(args) > 2: | ||
if autouse is False: | ||
autouse = args[2] | ||
else: | ||
duplicated_args.append("autouse") | ||
if len(args) > 3: | ||
if ids is None: | ||
ids = args[3] | ||
else: | ||
duplicated_args.append("ids") | ||
if len(args) > 4: | ||
if name is None: | ||
name = args[4] | ||
else: | ||
duplicated_args.append("name") | ||
if len(args) > 5: | ||
raise TypeError( | ||
"fixture() takes 5 positional arguments but {} were given".format(len(args)) | ||
) | ||
if duplicated_args: | ||
raise TypeError( | ||
"The fixture arguments are defined as positional and keyword: {}. " | ||
"Use only keyword arguments.".format(", ".join(duplicated_args)) | ||
) | ||
if args: | ||
warnings.warn(FIXTURE_POSITIONAL_ARGUMENTS, stacklevel=2) | ||
# End backward compatiblity. | ||
|
||
fixture_marker = FixtureFunctionMarker( | ||
scope=scope, params=params, autouse=autouse, ids=ids, name=name, | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is pretty confusing, suggest to read the full file instead.