pytest 6.1.0 (2020-09-26)
#5585: As per our policy, the following features which have been deprecated in the 5.X series are now
funcargnamesread-only property of
@pytest.fixtureno longer supports positional arguments, pass all arguments by keyword instead.
- Direct construction of
Nodesubclasses now raise an error, use
- The default value for
junit_familyhas changed to
xunit2. If you require the old format, add
junit_family=xunit1to your configuration file.
TerminalReporterno longer has a
writerattribute. Plugin authors may use the public functions of the
TerminalReporterinstead of accessing the
--result-logoption has been removed. Users are recommended to use the pytest-reportlog plugin instead.
For more information consult
Deprecations and Removals in the docs.
pytest.collectmodule is deprecated: all its names can be imported from
pytest._fillfuncargsfunction is deprecated. This function was kept
for backward compatibility with an older plugin.
It's functionality is not meant to be used directly, but if you must replace
it, use function._request._fillfixtures() instead, though note this is not
a public API and may break in the future.
#7210: The special
-k '-expr'syntax to
-kis deprecated. Use
-k 'not expr'
-k 'expr:'syntax to
-kis deprecated. Please open an issue
if you use this and want a replacement.
#7255: The pytest_warning_captured <_pytest.hookspec.pytest_warning_captured> hook is deprecated in favor
of pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>, and will be removed in a future version.
This should work on all pytest versions.
- #7667: New
--durations-mincommand-line flag controls the minimal duration for inclusion in the slowest list of tests shown by
--durations. Previously this was hard-coded to
#6681: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through filterwarnings or
#7572: When a plugin listed in
required_pluginsis missing or an unknown config key is used with
--strict-config, a simple error message is now shown instead of a stacktrace.
#7685: Added two new attributes rootpath <_pytest.config.Config.rootpath> and inipath <_pytest.config.Config.inipath> to Config <_pytest.config.Config>.
These attributes are pathlib.Path versions of the existing rootdir <_pytest.config.Config.rootdir> and inifile <_pytest.config.Config.inifile> attributes,
and should be preferred over them when possible.
#7780: Public classes which are not designed to be inherited from are now marked @final.
Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime.
finaldesignation does not appear in the API Reference but hopefully will in the future.
#1953: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value.
# conftest.py import pytest @pytest.fixture(params=[1, 2]) def foo(request): return request.param # test_foo.py import pytest @pytest.fixture def foo(foo): return foo * 2
#4984: Fixed an internal error crash with
IndexError: list index out of rangewhen
collecting a module which starts with a decorated function, the decorator
raises, and assertion rewriting is enabled.
#7591: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from File <non-python tests>.
#7628: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example
#7638: Fix handling of command-line options that appear as paths but trigger an OS-level syntax error on Windows, such as the options used internally by
#7742: Fixed INTERNALERROR when accessing locals / globals with faulty
- #1477: Removed faq.rst and its reference in contents.rst.
- #7536: The internal
junitxmlplugin has rewritten to use
The order of attributes in XML elements might differ. Some unneeded escaping is
no longer performed.
- #7587: The dependency on the
more-itertoolspackage has been removed.
- #7631: The result type of capfd.readouterr() <_pytest.capture.CaptureFixture.readouterr> (and similar) is no longer a namedtuple,
but should behave like one in all respects. This was done for technical reasons.
- #7671: When collecting tests, pytest finds test classes and functions by examining the
attributes of python objects (modules, classes and instances). To speed up this
process, pytest now ignores builtin attributes (like
__new__) without consulting the python_classes and
python_functions configuration options and without passing them to plugins
using the pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem> hook.