-
-
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
5.3.4 causing internal errors #6517
Comments
Thanks @dwhswenson for the detailed report, and sorry about the regression. That @dwhswenson do you have some form of custom plugin which is creating |
Not that I know of. I don't think our test suite has any custom pytest-based code beyond basic XUnit fixtures and One thing we do have is lots of legacy Looking a little more closely, it looks like the error is occurring on the first test that uses the |
Thanks for reporting @dwhswenson I was able to reproduce it. PR #6518 should fix it. It doesn't add a regression test, but it's just a revert so can be deferred to later. Sorry for the hassle @nicoddemus! |
Not at all, please. Thanks for the quick response! |
Thanks @dwhswenson, nailed it! This reproduces the issue: from nose.tools import raises
@raises(RuntimeError)
def test_fail_without_tcp():
raise RuntimeError |
I got this same error, and I have no idea what "nose" is. It only occurs for one of my test files, not for any others. |
because of error in 5.3.4: pytest-dev/pytest#6517
@nicoddemus JFI: you might want to explore the above referenced issues to get a picture about how unrelated changes might cause unforeseen problems (especially with an almost-hotfix release (#6516 (review))). |
A fix for this regression should be released shortly (via #6614). |
Agreed, indeed when making hot-fixes we should strive to only include that fix. |
6: Pin pytest to latest version 6.2.3 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.3**. <details> <summary>Changelog</summary> ### 6.2.2 ``` ========================= Bug Fixes --------- - `8152 <https://github.com/pytest-dev/pytest/issues/8152>`_: Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - `8249 <https://github.com/pytest-dev/pytest/issues/8249>`_: Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``. ``` ### 6.2.1 ``` ========================= Bug Fixes --------- - `7678 <https://github.com/pytest-dev/pytest/issues/7678>`_: Fixed bug where ``ImportPathMismatchError`` would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). - `8132 <https://github.com/pytest-dev/pytest/issues/8132>`_: Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises ``TypeError`` when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from ``numpy.ndarray``. ``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size. ``` ### 6.2.0 ``` ========================= Breaking Changes ---------------- - `7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only. Deprecations ------------ - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - `7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - `7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - `5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - `7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - `7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - `8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - `1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - `2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - `7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - `7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - `7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - `7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - `7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - `8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - `8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - `4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - `7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - `7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests. - `7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - `8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - `7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference. - `7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - `7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - `7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.) ``` ### 6.1.2 ``` ========================= Bug Fixes --------- - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by `tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation ---------------------- - `7815 <https://github.com/pytest-dev/pytest/issues/7815>`_: Improve deprecation warning message for ``pytest._fillfuncargs()``. ``` ### 6.1.1 ``` ========================= Bug Fixes --------- - `7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. - `7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). ``` ### 6.1.0 ``` ========================= Breaking Changes ---------------- - `5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series 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. Deprecations ------------ - `6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - `7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function 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 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - `7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - `7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. Improvements ------------ - `6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. This also fixes a number of long standing issues: `2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. - `7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. - `7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - `1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python 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 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - `7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - `7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). - `7638 <https://github.com/pytest-dev/pytest/issues/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 ``pytest-xdist``. - `7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - `1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - `7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - `7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. - `7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`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 <https://github.com/pytest-dev/pytest/issues/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 ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. ``` ### 6.0.2 ``` ========================= Bug Fixes --------- - `7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. - `7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. - `7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. - `7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). ``` ### 6.0.1 ``` ========================= Bug Fixes --------- - `7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. Passing ``None`` raises a more informative ``TypeError``. - `7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. - `7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. - `7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. ``` ### 6.0.0 ``` ========================= (**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) Breaking Changes ---------------- - `5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** Following our plan to remove deprecated features with as little disruption as possible, all warnings of type ``PytestDeprecationWarning`` now generate errors instead of warning messages. **The affected features will be effectively removed in pytest 6.1**, so please consult the `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ section in the docs for directions on how to update existing code. In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest ``6.1`` is released. **If you have concerns** about the removal of a specific feature, please add a comment to `5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. - `7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. Features -------- - `7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements ------------ - `7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. - `7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. Bug Fixes --------- - `7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``pytest.mark.skip`` when ``--runxfail`` is used. - `7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. - `7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. - `7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. Improved Documentation ---------------------- - `7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. - `7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. Trivial/Internal Changes ------------------------ - `7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. ``` ### 6.0.0rc1 ``` ============================ Breaking Changes ---------------- - `1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. - `5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in `6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. - `6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) caused an unintended regression by changing the keys returned by ``parseoutcomes()``. Now the API guarantees to always return the plural form, so calls like this: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(errors=1) - `6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. - `7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. Also, ``pytest.Package.name`` is now just the name of the directory containing the package's ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why ``-k`` would match against any directory containing the test suite. - `7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. - `7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` (and similar methods), or ``_pytest.config.create_terminal_writer()``. The following breaking changes were made: - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or ``terminal_writer.flush()``. - Explicit Windows console support was removed, delegated to the colorama library. - Support for writing ``bytes`` was removed. - The ``reline`` method and ``chars_on_current_line`` property were removed. - The ``stringio`` and ``encoding`` arguments was removed. - Support for passing a callable instead of a file was removed. - `7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. - `7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. - `7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. - `7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here for the benefit of plugin authors who may be using it: - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. - Support for zero or multiple arguments to ``Source()`` has been removed. - Support for comparing ``Source`` with an ``str`` has been removed. - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have been removed; use plain ``compile()`` instead. - The function ``_pytest._code.source.getsource()`` has been removed; use ``Source()`` directly instead. Deprecations ------------ - `7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. Features -------- - `1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: .. code-block:: toml pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. - `3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. - `6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. * `--no-summary`: disables the final test summary, including warnings. - `6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. The `--strict-config` flag has been added to treat these warnings as errors. - `6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. - `7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged to try the new mode and provide feedback (both positive or negative) in issue `7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. - `7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. Improvements ------------ - `4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that is printed to stderr when the output of ``pytest`` is piped and and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). - `4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). - `4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. - `6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. - `6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. - `6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. - `6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. - `7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. - `7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. - `7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. - `7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. - `7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the *Captured log report* report section. - `7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. - `7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. Previously: .. code-block:: xml <error message="test setup failure"> Now: .. code-block:: xml <error message="failed on setup with &quot;ValueError: Some error during setup&quot;"> Bug Fixes --------- - `1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. - `4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log messages to stderr. - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. - `7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. - `7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` parameter when Python is called with the ``-bb`` flag. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, if the ``autouse`` or ``params`` arguments are also passed, the function is no longer ignored, but is marked as a fixture. - `7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, in rare circumstances where the exact same string is used but refers to different global values. - `7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. Improved Documentation ---------------------- - `7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. - `7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes ------------------------ - `7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not provided explicitly, and is always set. - `7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. - `7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. - `7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. - `7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. - `7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. ``` ### 5.4.3 ``` ========================= Bug Fixes --------- - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` subclasses for skipped tests. ``` ### 5.4.2 ``` ========================= Bug Fixes --------- - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_parent`` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. ``` ### 5.4.1 ``` ========================= Bug Fixes --------- - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. ``` ### 5.4.0 ``` ========================= Breaking Changes ---------------- - `6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. - `6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. - `6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. - `6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - `6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when the result is unavailable, instead of being deleted. If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, set it to ``None`` instead. Deprecations ------------ - `3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and provide feedback. ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). - `571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. It was misaligned since the removal of the ``Directory`` collector in 2010 and incorrect/unusable as soon as collection was split from test execution. - `5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. Instead they are now constructed via ``Node.from_parent``. This transitional mechanism enables us to untangle the very intensely entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. - `6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with ``py.io.TerminalWriter``. Features -------- - `4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. - `5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). - `6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. - `6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements ------------ - `1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. - `449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. - `5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. - `5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. - `6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. - `6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. - `6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. - `6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. - `6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. Users are encouraged to install ``pygments`` into their environment and provide feedback, because the plan is to make ``pygments`` a regular dependency in the future. - `6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. - `759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. Bug Fixes --------- - `310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. - `3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. - `4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. - `5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. - `5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. - `5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. - `6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). The upper case variants were never documented and the preferred form should be the lower case. - `6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. - `6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. The implemented fix replaces `==` with ``is``. - `6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. - `6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. - `6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined in the configuration file. - `6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. - `6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. - `6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. - `6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), a `match` keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). - `6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. - `6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. Improved Documentation ---------------------- - `6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. - `6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes ------------------------ - `6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. ``` ### 5.3.5 ``` ========================= Bug Fixes --------- - `6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. ``` ### 5.3.4 ``` ========================= Bug Fixes --------- - `6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, so the team decided to revert this change and make a new release while we continue to look for a solution. ``` ### 5.3.3 ``` ========================= Bug Fixes --------- - `2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. - `5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the ``multiprocessing`` module. - `6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and parameterized fixtures that execute before them in the fixture stack so they are torn down at the right times, and in the right order. - `6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). Trivial/Internal Changes ------------------------ - `6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. ``` ### 5.3.2 ``` ========================= Improvements ------------ - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. Bug Fixes --------- - `5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. - `6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. - `6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). ``` ### 5.3.1 ``` ========================= Improvements ------------ - `6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. - `6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. Bug Fixes --------- - `5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: pytester: fix :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` when used after positive matching. - `6082 <https://github.com/pytest-dev/pytest/issues/6082>`_: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround to `bpo-17446 <https://bugs.python.org/issue17446>`__. - `6254 <https://github.com/pytest-dev/pytest/issues/6254>`_: Fix compatibility with pytest-parallel (regression in pytest 5.3.0). - `6255 <https://github.com/pytest-dev/pytest/issues/6255>`_: Clear the :py:data:`sys.last_traceback`, :py:data:`sys.last_type` and :py:data:`sys.last_value` attributes by deleting them instead of setting them to ``None``. This better matches the behaviour of the Python standard library. ``` ### 5.3.0 ``` ========================= Deprecations ------------ - `6179 <https://github.com/pytest-dev/pytest/issues/6179>`_: The default value of :confval:`junit_family` option will change to ``"xunit2"`` in pytest 6.0, given that this is the version supported by default in modern tools that manipulate this type of file. In order to smooth the transition, pytest will issue a warning in case the ``--junitxml`` o…
6: Pin pytest to latest version 6.2.3 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.3**. <details> <summary>Changelog</summary> ### 6.2.2 ``` ========================= Bug Fixes --------- - `8152 <https://github.com/pytest-dev/pytest/issues/8152>`_: Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - `8249 <https://github.com/pytest-dev/pytest/issues/8249>`_: Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``. ``` ### 6.2.1 ``` ========================= Bug Fixes --------- - `7678 <https://github.com/pytest-dev/pytest/issues/7678>`_: Fixed bug where ``ImportPathMismatchError`` would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). - `8132 <https://github.com/pytest-dev/pytest/issues/8132>`_: Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises ``TypeError`` when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from ``numpy.ndarray``. ``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size. ``` ### 6.2.0 ``` ========================= Breaking Changes ---------------- - `7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only. Deprecations ------------ - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - `7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - `7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - `5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - `7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - `7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - `8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - `1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - `2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - `7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - `7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - `7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - `7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - `7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - `8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - `8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - `4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - `7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - `7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests. - `7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - `8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - `7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference. - `7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - `7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - `7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.) ``` ### 6.1.2 ``` ========================= Bug Fixes --------- - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by `tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation ---------------------- - `7815 <https://github.com/pytest-dev/pytest/issues/7815>`_: Improve deprecation warning message for ``pytest._fillfuncargs()``. ``` ### 6.1.1 ``` ========================= Bug Fixes --------- - `7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. - `7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). ``` ### 6.1.0 ``` ========================= Breaking Changes ---------------- - `5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series 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. Deprecations ------------ - `6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - `7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function 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 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - `7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - `7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. Improvements ------------ - `6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. This also fixes a number of long standing issues: `2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. - `7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. - `7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - `1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python 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 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - `7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - `7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). - `7638 <https://github.com/pytest-dev/pytest/issues/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 ``pytest-xdist``. - `7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - `1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - `7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - `7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. - `7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`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 <https://github.com/pytest-dev/pytest/issues/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 ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. ``` ### 6.0.2 ``` ========================= Bug Fixes --------- - `7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. - `7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. - `7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. - `7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). ``` ### 6.0.1 ``` ========================= Bug Fixes --------- - `7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. Passing ``None`` raises a more informative ``TypeError``. - `7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. - `7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. - `7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. ``` ### 6.0.0 ``` ========================= (**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) Breaking Changes ---------------- - `5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** Following our plan to remove deprecated features with as little disruption as possible, all warnings of type ``PytestDeprecationWarning`` now generate errors instead of warning messages. **The affected features will be effectively removed in pytest 6.1**, so please consult the `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ section in the docs for directions on how to update existing code. In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest ``6.1`` is released. **If you have concerns** about the removal of a specific feature, please add a comment to `5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. - `7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. Features -------- - `7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements ------------ - `7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. - `7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. Bug Fixes --------- - `7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``pytest.mark.skip`` when ``--runxfail`` is used. - `7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. - `7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. - `7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. Improved Documentation ---------------------- - `7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. - `7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. Trivial/Internal Changes ------------------------ - `7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. ``` ### 6.0.0rc1 ``` ============================ Breaking Changes ---------------- - `1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. - `5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in `6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. - `6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) caused an unintended regression by changing the keys returned by ``parseoutcomes()``. Now the API guarantees to always return the plural form, so calls like this: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(errors=1) - `6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. - `7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. Also, ``pytest.Package.name`` is now just the name of the directory containing the package's ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why ``-k`` would match against any directory containing the test suite. - `7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. - `7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` (and similar methods), or ``_pytest.config.create_terminal_writer()``. The following breaking changes were made: - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or ``terminal_writer.flush()``. - Explicit Windows console support was removed, delegated to the colorama library. - Support for writing ``bytes`` was removed. - The ``reline`` method and ``chars_on_current_line`` property were removed. - The ``stringio`` and ``encoding`` arguments was removed. - Support for passing a callable instead of a file was removed. - `7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. - `7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. - `7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. - `7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here for the benefit of plugin authors who may be using it: - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. - Support for zero or multiple arguments to ``Source()`` has been removed. - Support for comparing ``Source`` with an ``str`` has been removed. - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have been removed; use plain ``compile()`` instead. - The function ``_pytest._code.source.getsource()`` has been removed; use ``Source()`` directly instead. Deprecations ------------ - `7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. Features -------- - `1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: .. code-block:: toml pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. - `3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. - `6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. * `--no-summary`: disables the final test summary, including warnings. - `6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. The `--strict-config` flag has been added to treat these warnings as errors. - `6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. - `7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged to try the new mode and provide feedback (both positive or negative) in issue `7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. - `7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. Improvements ------------ - `4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that is printed to stderr when the output of ``pytest`` is piped and and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). - `4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). - `4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. - `6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. - `6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. - `6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. - `6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. - `7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. - `7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. - `7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. - `7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. - `7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the *Captured log report* report section. - `7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. - `7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. Previously: .. code-block:: xml <error message="test setup failure"> Now: .. code-block:: xml <error message="failed on setup with &quot;ValueError: Some error during setup&quot;"> Bug Fixes --------- - `1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. - `4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log messages to stderr. - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. - `7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. - `7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` parameter when Python is called with the ``-bb`` flag. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, if the ``autouse`` or ``params`` arguments are also passed, the function is no longer ignored, but is marked as a fixture. - `7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, in rare circumstances where the exact same string is used but refers to different global values. - `7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. Improved Documentation ---------------------- - `7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. - `7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes ------------------------ - `7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not provided explicitly, and is always set. - `7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. - `7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. - `7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. - `7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. - `7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. ``` ### 5.4.3 ``` ========================= Bug Fixes --------- - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` subclasses for skipped tests. ``` ### 5.4.2 ``` ========================= Bug Fixes --------- - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_parent`` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. ``` ### 5.4.1 ``` ========================= Bug Fixes --------- - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. ``` ### 5.4.0 ``` ========================= Breaking Changes ---------------- - `6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. - `6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. - `6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. - `6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - `6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when the result is unavailable, instead of being deleted. If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, set it to ``None`` instead. Deprecations ------------ - `3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and provide feedback. ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). - `571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. It was misaligned since the removal of the ``Directory`` collector in 2010 and incorrect/unusable as soon as collection was split from test execution. - `5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. Instead they are now constructed via ``Node.from_parent``. This transitional mechanism enables us to untangle the very intensely entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. - `6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with ``py.io.TerminalWriter``. Features -------- - `4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. - `5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). - `6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. - `6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements ------------ - `1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. - `449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. - `5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. - `5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. - `6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. - `6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. - `6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. - `6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. - `6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. Users are encouraged to install ``pygments`` into their environment and provide feedback, because the plan is to make ``pygments`` a regular dependency in the future. - `6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. - `759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. Bug Fixes --------- - `310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. - `3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. - `4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. - `5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. - `5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. - `5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. - `6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). The upper case variants were never documented and the preferred form should be the lower case. - `6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. - `6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. The implemented fix replaces `==` with ``is``. - `6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. - `6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. - `6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined in the configuration file. - `6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. - `6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. - `6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. - `6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), a `match` keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). - `6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. - `6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. Improved Documentation ---------------------- - `6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. - `6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes ------------------------ - `6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. ``` ### 5.3.5 ``` ========================= Bug Fixes --------- - `6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. ``` ### 5.3.4 ``` ========================= Bug Fixes --------- - `6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, so the team decided to revert this change and make a new release while we continue to look for a solution. ``` ### 5.3.3 ``` ========================= Bug Fixes --------- - `2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. - `5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the ``multiprocessing`` module. - `6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and parameterized fixtures that execute before them in the fixture stack so they are torn down at the right times, and in the right order. - `6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). Trivial/Internal Changes ------------------------ - `6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. ``` ### 5.3.2 ``` ========================= Improvements ------------ - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. Bug Fixes --------- - `5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. - `6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. - `6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). ``` ### 5.3.1 ``` ========================= Improvements ------------ - `6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. - `6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. Bug Fixes --------- - `5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: pytester: fix :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` when used after positive matching. - `6082 <https://github.com/pytest-dev/pytest/issues/6082>`_: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround to `bpo-17446 <https://bugs.python.org/issue17446>`__. - `6254 <https://github.com/pytest-dev/pytest/issues/6254>`_: Fix compatibility with pytest-parallel (regression in pytest 5.3.0). - `6255 <https://github.com/pytest-dev/pytest/issues/6255>`_: Clear the :py:data:`sys.last_traceback`, :py:data:`sys.last_type` and :py:data:`sys.last_value` attributes by deleting them instead of setting them to ``None``. This better matches the behaviour of the Python standard library. ``` ### 5.3.0 ``` ========================= Deprecations ------------ - `6179 <https://github.com/pytest-dev/pytest/issues/6179>`_: The default value of :confval:`junit_family` option will change to ``"xunit2"`` in pytest 6.0, given that this is the version supported by default in modern tools that manipulate this type of file. In order to smooth the transition, pytest will issue a warning in case the ``--junitxml`` opti…
3: Pin sphinx_rtd_theme to latest version 0.5.1 r=aragilar a=pyup-bot This PR pins [sphinx_rtd_theme](https://pypi.org/project/sphinx_rtd_theme) to the latest release **0.5.1**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/sphinx-rtd-theme - Repo: https://github.com/readthedocs/sphinx_rtd_theme </details> 4: Pin pytest to latest version 6.2.2 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.2**. <details> <summary>Changelog</summary> ### 6.2.2 ``` ========================= Bug Fixes --------- - `8152 <https://github.com/pytest-dev/pytest/issues/8152>`_: Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - `8249 <https://github.com/pytest-dev/pytest/issues/8249>`_: Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``. ``` ### 6.2.1 ``` ========================= Bug Fixes --------- - `7678 <https://github.com/pytest-dev/pytest/issues/7678>`_: Fixed bug where ``ImportPathMismatchError`` would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). - `8132 <https://github.com/pytest-dev/pytest/issues/8132>`_: Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises ``TypeError`` when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from ``numpy.ndarray``. ``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size. ``` ### 6.2.0 ``` ========================= Breaking Changes ---------------- - `7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only. Deprecations ------------ - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - `7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - `7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - `5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - `7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - `7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - `8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - `1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - `2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - `7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - `7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - `7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - `7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - `7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - `8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - `8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - `4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - `7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - `7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests. - `7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - `8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - `7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference. - `7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - `7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - `7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.) ``` ### 6.1.2 ``` ========================= Bug Fixes --------- - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by `tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation ---------------------- - `7815 <https://github.com/pytest-dev/pytest/issues/7815>`_: Improve deprecation warning message for ``pytest._fillfuncargs()``. ``` ### 6.1.1 ``` ========================= Bug Fixes --------- - `7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. - `7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). ``` ### 6.1.0 ``` ========================= Breaking Changes ---------------- - `5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series 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. Deprecations ------------ - `6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - `7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function 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 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - `7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - `7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. Improvements ------------ - `6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. This also fixes a number of long standing issues: `2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. - `7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. - `7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - `1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python 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 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - `7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - `7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). - `7638 <https://github.com/pytest-dev/pytest/issues/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 ``pytest-xdist``. - `7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - `1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - `7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - `7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. - `7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`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 <https://github.com/pytest-dev/pytest/issues/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 ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. ``` ### 6.0.2 ``` ========================= Bug Fixes --------- - `7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. - `7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. - `7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. - `7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). ``` ### 6.0.1 ``` ========================= Bug Fixes --------- - `7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. Passing ``None`` raises a more informative ``TypeError``. - `7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. - `7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. - `7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. ``` ### 6.0.0 ``` ========================= (**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) Breaking Changes ---------------- - `5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** Following our plan to remove deprecated features with as little disruption as possible, all warnings of type ``PytestDeprecationWarning`` now generate errors instead of warning messages. **The affected features will be effectively removed in pytest 6.1**, so please consult the `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ section in the docs for directions on how to update existing code. In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest ``6.1`` is released. **If you have concerns** about the removal of a specific feature, please add a comment to `5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. - `7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. Features -------- - `7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements ------------ - `7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. - `7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. Bug Fixes --------- - `7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``pytest.mark.skip`` when ``--runxfail`` is used. - `7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. - `7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. - `7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. Improved Documentation ---------------------- - `7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. - `7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. Trivial/Internal Changes ------------------------ - `7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. ``` ### 6.0.0rc1 ``` ============================ Breaking Changes ---------------- - `1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. - `5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in `6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. - `6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) caused an unintended regression by changing the keys returned by ``parseoutcomes()``. Now the API guarantees to always return the plural form, so calls like this: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(errors=1) - `6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. - `7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. Also, ``pytest.Package.name`` is now just the name of the directory containing the package's ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why ``-k`` would match against any directory containing the test suite. - `7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. - `7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` (and similar methods), or ``_pytest.config.create_terminal_writer()``. The following breaking changes were made: - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or ``terminal_writer.flush()``. - Explicit Windows console support was removed, delegated to the colorama library. - Support for writing ``bytes`` was removed. - The ``reline`` method and ``chars_on_current_line`` property were removed. - The ``stringio`` and ``encoding`` arguments was removed. - Support for passing a callable instead of a file was removed. - `7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. - `7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. - `7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. - `7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here for the benefit of plugin authors who may be using it: - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. - Support for zero or multiple arguments to ``Source()`` has been removed. - Support for comparing ``Source`` with an ``str`` has been removed. - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have been removed; use plain ``compile()`` instead. - The function ``_pytest._code.source.getsource()`` has been removed; use ``Source()`` directly instead. Deprecations ------------ - `7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. Features -------- - `1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: .. code-block:: toml pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. - `3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. - `6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. * `--no-summary`: disables the final test summary, including warnings. - `6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. The `--strict-config` flag has been added to treat these warnings as errors. - `6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. - `7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged to try the new mode and provide feedback (both positive or negative) in issue `7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. - `7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. Improvements ------------ - `4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that is printed to stderr when the output of ``pytest`` is piped and and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). - `4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). - `4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. - `6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. - `6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. - `6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. - `6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. - `7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. - `7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. - `7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. - `7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. - `7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the *Captured log report* report section. - `7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. - `7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. Previously: .. code-block:: xml <error message="test setup failure"> Now: .. code-block:: xml <error message="failed on setup with &quot;ValueError: Some error during setup&quot;"> Bug Fixes --------- - `1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. - `4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log messages to stderr. - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. - `7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. - `7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` parameter when Python is called with the ``-bb`` flag. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, if the ``autouse`` or ``params`` arguments are also passed, the function is no longer ignored, but is marked as a fixture. - `7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, in rare circumstances where the exact same string is used but refers to different global values. - `7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. Improved Documentation ---------------------- - `7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. - `7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes ------------------------ - `7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not provided explicitly, and is always set. - `7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. - `7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. - `7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. - `7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. - `7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. ``` ### 5.4.3 ``` ========================= Bug Fixes --------- - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` subclasses for skipped tests. ``` ### 5.4.2 ``` ========================= Bug Fixes --------- - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. ``` ### 5.4.1 ``` ========================= Bug Fixes --------- - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. ``` ### 5.4.0 ``` ========================= Breaking Changes ---------------- - `6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. - `6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. - `6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. - `6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - `6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when the result is unavailable, instead of being deleted. If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, set it to ``None`` instead. Deprecations ------------ - `3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and provide feedback. ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). - `571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. It was misaligned since the removal of the ``Directory`` collector in 2010 and incorrect/unusable as soon as collection was split from test execution. - `5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. Instead they are now constructed via ``Node.from_parent``. This transitional mechanism enables us to untangle the very intensely entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. - `6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with ``py.io.TerminalWriter``. Features -------- - `4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. - `5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). - `6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. - `6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements ------------ - `1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. - `449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. - `5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. - `5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. - `6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. - `6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. - `6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. - `6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. - `6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. Users are encouraged to install ``pygments`` into their environment and provide feedback, because the plan is to make ``pygments`` a regular dependency in the future. - `6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. - `759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. Bug Fixes --------- - `310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. - `3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. - `4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. - `5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. - `5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. - `5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. - `6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). The upper case variants were never documented and the preferred form should be the lower case. - `6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. - `6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. The implemented fix replaces `==` with ``is``. - `6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. - `6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. - `6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined in the configuration file. - `6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. - `6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. - `6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. - `6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), a `match` keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). - `6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. - `6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. Improved Documentation ---------------------- - `6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. - `6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes ------------------------ - `6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. ``` ### 5.3.5 ``` ========================= Bug Fixes --------- - `6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. ``` ### 5.3.4 ``` ========================= Bug Fixes --------- - `6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, so the team decided to revert this change and make a new release while we continue to look for a solution. ``` ### 5.3.3 ``` ========================= Bug Fixes --------- - `2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. - `5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the ``multiprocessing`` module. - `6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and parameterized fixtures that execute before them in the fixture stack so they are torn down at the right times, and in the right order. - `6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). Trivial/Internal Changes ------------------------ - `6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. ``` ### 5.3.2 ``` ========================= Improvements ------------ - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. Bug Fixes --------- - `5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. - `6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. - `6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). ``` ### 5.3.1 ``` ========================= Improvements ------------ - `6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. - `6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. Bug Fixes --------- - `5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: pytester: fix :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` when used after positive matching. - `6082 <https://github.com/pytest-dev/pytest/issues/6082>`_: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround to `bpo-17446 <https://bugs.python.org/issue17446>`__. - `6254 <https://github.com/pytest-dev/pytest/issues/6254>`_: Fix compatibility with pytest-parallel (regression in pytest 5.3.0). - `6255 <https://github.com/pytest-dev/pytest/issues/6255>`_: Clear the :py:data:`sys.last_traceback`, :py:data:`sys.last_type` and :py:data:`sys.last_value` attributes by deleting them instead of setting them to ``None``. This better matches the behaviour of the Python standar…
7: Pin sphinx_rtd_theme to latest version 0.5.2 r=aragilar a=pyup-bot This PR pins [sphinx_rtd_theme](https://pypi.org/project/sphinx_rtd_theme) to the latest release **0.5.2**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/sphinx-rtd-theme - Repo: https://github.com/readthedocs/sphinx_rtd_theme </details> 8: Pin pytest to latest version 6.2.4 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.4**. <details> <summary>Changelog</summary> ### 6.2.4 ``` ========================= Bug Fixes --------- - `8539 <https://github.com/pytest-dev/pytest/issues/8539>`_: Fixed assertion rewriting on Python 3.10. ``` ### 6.2.3 ``` ========================= Bug Fixes --------- - `8414 <https://github.com/pytest-dev/pytest/issues/8414>`_: pytest used to create directories under ``/tmp`` with world-readable permissions. This means that any user in the system was able to read information written by tests in temporary directories (such as those created by the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with private permissions. pytest used to silenty use a pre-existing ``/tmp/pytest-of-<username>`` directory, even if owned by another user. This means another user could pre-create such a directory and gain control of another user's temporary directory. Now such a condition results in an error. ``` ### 6.2.2 ``` ========================= Bug Fixes --------- - `8152 <https://github.com/pytest-dev/pytest/issues/8152>`_: Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - `8249 <https://github.com/pytest-dev/pytest/issues/8249>`_: Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``. ``` ### 6.2.1 ``` ========================= Bug Fixes --------- - `7678 <https://github.com/pytest-dev/pytest/issues/7678>`_: Fixed bug where ``ImportPathMismatchError`` would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). - `8132 <https://github.com/pytest-dev/pytest/issues/8132>`_: Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises ``TypeError`` when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from ``numpy.ndarray``. ``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size. ``` ### 6.2.0 ``` ========================= Breaking Changes ---------------- - `7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only. Deprecations ------------ - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - `7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - `7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - `5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - `7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - `7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - `8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - `1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - `2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - `7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - `7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - `7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - `7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - `7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - `8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - `8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - `4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - `7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - `7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests. - `7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - `8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - `7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference. - `7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - `7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - `7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.) ``` ### 6.1.2 ``` ========================= Bug Fixes --------- - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by `tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation ---------------------- - `7815 <https://github.com/pytest-dev/pytest/issues/7815>`_: Improve deprecation warning message for ``pytest._fillfuncargs()``. ``` ### 6.1.1 ``` ========================= Bug Fixes --------- - `7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. - `7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). ``` ### 6.1.0 ``` ========================= Breaking Changes ---------------- - `5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series 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. Deprecations ------------ - `6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - `7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function 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 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - `7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - `7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. Improvements ------------ - `6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. This also fixes a number of long standing issues: `2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. - `7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. - `7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - `1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python 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 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - `7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - `7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). - `7638 <https://github.com/pytest-dev/pytest/issues/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 ``pytest-xdist``. - `7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - `1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - `7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - `7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. - `7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`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 <https://github.com/pytest-dev/pytest/issues/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 ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. ``` ### 6.0.2 ``` ========================= Bug Fixes --------- - `7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. - `7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. - `7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. - `7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). ``` ### 6.0.1 ``` ========================= Bug Fixes --------- - `7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. Passing ``None`` raises a more informative ``TypeError``. - `7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. - `7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. - `7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. ``` ### 6.0.0 ``` ========================= (**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) Breaking Changes ---------------- - `5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** Following our plan to remove deprecated features with as little disruption as possible, all warnings of type ``PytestDeprecationWarning`` now generate errors instead of warning messages. **The affected features will be effectively removed in pytest 6.1**, so please consult the `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ section in the docs for directions on how to update existing code. In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest ``6.1`` is released. **If you have concerns** about the removal of a specific feature, please add a comment to `5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. - `7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. Features -------- - `7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements ------------ - `7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. - `7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. Bug Fixes --------- - `7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``pytest.mark.skip`` when ``--runxfail`` is used. - `7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. - `7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. - `7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. Improved Documentation ---------------------- - `7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. - `7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. Trivial/Internal Changes ------------------------ - `7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. ``` ### 6.0.0rc1 ``` ============================ Breaking Changes ---------------- - `1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. - `5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in `6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. - `6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) caused an unintended regression by changing the keys returned by ``parseoutcomes()``. Now the API guarantees to always return the plural form, so calls like this: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(errors=1) - `6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. - `7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. Also, ``pytest.Package.name`` is now just the name of the directory containing the package's ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why ``-k`` would match against any directory containing the test suite. - `7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. - `7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` (and similar methods), or ``_pytest.config.create_terminal_writer()``. The following breaking changes were made: - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or ``terminal_writer.flush()``. - Explicit Windows console support was removed, delegated to the colorama library. - Support for writing ``bytes`` was removed. - The ``reline`` method and ``chars_on_current_line`` property were removed. - The ``stringio`` and ``encoding`` arguments was removed. - Support for passing a callable instead of a file was removed. - `7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. - `7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. - `7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. - `7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here for the benefit of plugin authors who may be using it: - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. - Support for zero or multiple arguments to ``Source()`` has been removed. - Support for comparing ``Source`` with an ``str`` has been removed. - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have been removed; use plain ``compile()`` instead. - The function ``_pytest._code.source.getsource()`` has been removed; use ``Source()`` directly instead. Deprecations ------------ - `7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. Features -------- - `1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: .. code-block:: toml pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. - `3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. - `6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. * `--no-summary`: disables the final test summary, including warnings. - `6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. The `--strict-config` flag has been added to treat these warnings as errors. - `6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. - `7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged to try the new mode and provide feedback (both positive or negative) in issue `7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. - `7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. Improvements ------------ - `4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that is printed to stderr when the output of ``pytest`` is piped and and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). - `4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). - `4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. - `6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. - `6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. - `6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. - `6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. - `7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. - `7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. - `7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. - `7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. - `7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the *Captured log report* report section. - `7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. - `7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. Previously: .. code-block:: xml <error message="test setup failure"> Now: .. code-block:: xml <error message="failed on setup with &quot;ValueError: Some error during setup&quot;"> Bug Fixes --------- - `1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. - `4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log messages to stderr. - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. - `7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. - `7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` parameter when Python is called with the ``-bb`` flag. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, if the ``autouse`` or ``params`` arguments are also passed, the function is no longer ignored, but is marked as a fixture. - `7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, in rare circumstances where the exact same string is used but refers to different global values. - `7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. Improved Documentation ---------------------- - `7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. - `7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes ------------------------ - `7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not provided explicitly, and is always set. - `7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. - `7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. - `7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. - `7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. - `7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. ``` ### 5.4.3 ``` ========================= Bug Fixes --------- - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` subclasses for skipped tests. ``` ### 5.4.2 ``` ========================= Bug Fixes --------- - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_parent`` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. ``` ### 5.4.1 ``` ========================= Bug Fixes --------- - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. ``` ### 5.4.0 ``` ========================= Breaking Changes ---------------- - `6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. - `6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. - `6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. - `6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - `6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when the result is unavailable, instead of being deleted. If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, set it to ``None`` instead. Deprecations ------------ - `3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and provide feedback. ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). - `571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. It was misaligned since the removal of the ``Directory`` collector in 2010 and incorrect/unusable as soon as collection was split from test execution. - `5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. Instead they are now constructed via ``Node.from_parent``. This transitional mechanism enables us to untangle the very intensely entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. - `6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with ``py.io.TerminalWriter``. Features -------- - `4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. - `5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). - `6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. - `6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements ------------ - `1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. - `449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. - `5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. - `5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. - `6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. - `6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. - `6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. - `6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. - `6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. Users are encouraged to install ``pygments`` into their environment and provide feedback, because the plan is to make ``pygments`` a regular dependency in the future. - `6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. - `759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. Bug Fixes --------- - `310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. - `3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. - `4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. - `5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. - `5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. - `5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. - `6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). The upper case variants were never documented and the preferred form should be the lower case. - `6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. - `6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. The implemented fix replaces `==` with ``is``. - `6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. - `6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. - `6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined in the configuration file. - `6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. - `6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. - `6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. - `6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), a `match` keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). - `6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. - `6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. Improved Documentation ---------------------- - `6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. - `6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes ------------------------ - `6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. ``` ### 5.3.5 ``` ========================= Bug Fixes --------- - `6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. ``` ### 5.3.4 ``` ========================= Bug Fixes --------- - `6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, so the team decided to revert this change and make a new release while we continue to look for a solution. ``` ### 5.3.3 ``` ========================= Bug Fixes --------- - `2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. - `5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the ``multiprocessing`` module. - `6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and parameterized fixtures that execute before them in the fixture stack so they are torn down at the right times, and in the right order. - `6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). Trivial/Internal Changes ------------------------ - `6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. ``` ### 5.3.2 ``` ========================= Improvements ------------ - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. Bug Fixes --------- - `5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. - `6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. - `6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). ``` ### 5.3.1 ``` ========================= Improvements ------------ - `6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. - `6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being use…
4: Pin pytest to latest version 6.2.2 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.2**. <details> <summary>Changelog</summary> ### 6.2.2 ``` ========================= Bug Fixes --------- - `8152 <https://github.com/pytest-dev/pytest/issues/8152>`_: Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - `8249 <https://github.com/pytest-dev/pytest/issues/8249>`_: Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``. ``` ### 6.2.1 ``` ========================= Bug Fixes --------- - `7678 <https://github.com/pytest-dev/pytest/issues/7678>`_: Fixed bug where ``ImportPathMismatchError`` would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). - `8132 <https://github.com/pytest-dev/pytest/issues/8132>`_: Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises ``TypeError`` when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from ``numpy.ndarray``. ``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size. ``` ### 6.2.0 ``` ========================= Breaking Changes ---------------- - `7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only. Deprecations ------------ - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - `7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - `7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - `5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - `7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - `7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - `8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - `1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - `2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - `7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - `7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - `7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - `7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - `7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - `8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - `8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - `4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - `7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - `7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests. - `7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - `8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - `7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference. - `7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - `7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - `7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.) ``` ### 6.1.2 ``` ========================= Bug Fixes --------- - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by `tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation ---------------------- - `7815 <https://github.com/pytest-dev/pytest/issues/7815>`_: Improve deprecation warning message for ``pytest._fillfuncargs()``. ``` ### 6.1.1 ``` ========================= Bug Fixes --------- - `7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. - `7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). ``` ### 6.1.0 ``` ========================= Breaking Changes ---------------- - `5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series 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. Deprecations ------------ - `6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - `7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function 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 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - `7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - `7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. Improvements ------------ - `6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. This also fixes a number of long standing issues: `2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. - `7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. - `7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - `1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python 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 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - `7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - `7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). - `7638 <https://github.com/pytest-dev/pytest/issues/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 ``pytest-xdist``. - `7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - `1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - `7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - `7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. - `7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`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 <https://github.com/pytest-dev/pytest/issues/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 ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. ``` ### 6.0.2 ``` ========================= Bug Fixes --------- - `7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. - `7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. - `7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. - `7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). ``` ### 6.0.1 ``` ========================= Bug Fixes --------- - `7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. Passing ``None`` raises a more informative ``TypeError``. - `7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. - `7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. - `7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. ``` ### 6.0.0 ``` ========================= (**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) Breaking Changes ---------------- - `5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** Following our plan to remove deprecated features with as little disruption as possible, all warnings of type ``PytestDeprecationWarning`` now generate errors instead of warning messages. **The affected features will be effectively removed in pytest 6.1**, so please consult the `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ section in the docs for directions on how to update existing code. In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest ``6.1`` is released. **If you have concerns** about the removal of a specific feature, please add a comment to `5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. - `7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. Features -------- - `7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements ------------ - `7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. - `7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. Bug Fixes --------- - `7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``pytest.mark.skip`` when ``--runxfail`` is used. - `7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. - `7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. - `7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. Improved Documentation ---------------------- - `7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. - `7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. Trivial/Internal Changes ------------------------ - `7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. ``` ### 6.0.0rc1 ``` ============================ Breaking Changes ---------------- - `1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. - `5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in `6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. - `6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) caused an unintended regression by changing the keys returned by ``parseoutcomes()``. Now the API guarantees to always return the plural form, so calls like this: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(errors=1) - `6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. - `7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. Also, ``pytest.Package.name`` is now just the name of the directory containing the package's ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why ``-k`` would match against any directory containing the test suite. - `7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. - `7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` (and similar methods), or ``_pytest.config.create_terminal_writer()``. The following breaking changes were made: - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or ``terminal_writer.flush()``. - Explicit Windows console support was removed, delegated to the colorama library. - Support for writing ``bytes`` was removed. - The ``reline`` method and ``chars_on_current_line`` property were removed. - The ``stringio`` and ``encoding`` arguments was removed. - Support for passing a callable instead of a file was removed. - `7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. - `7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. - `7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. - `7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here for the benefit of plugin authors who may be using it: - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. - Support for zero or multiple arguments to ``Source()`` has been removed. - Support for comparing ``Source`` with an ``str`` has been removed. - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have been removed; use plain ``compile()`` instead. - The function ``_pytest._code.source.getsource()`` has been removed; use ``Source()`` directly instead. Deprecations ------------ - `7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. Features -------- - `1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: .. code-block:: toml pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. - `3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. - `6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. * `--no-summary`: disables the final test summary, including warnings. - `6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. The `--strict-config` flag has been added to treat these warnings as errors. - `6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. - `7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged to try the new mode and provide feedback (both positive or negative) in issue `7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. - `7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. Improvements ------------ - `4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that is printed to stderr when the output of ``pytest`` is piped and and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). - `4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). - `4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. - `6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. - `6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. - `6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. - `6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. - `7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. - `7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. - `7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. - `7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. - `7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the *Captured log report* report section. - `7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. - `7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. Previously: .. code-block:: xml <error message="test setup failure"> Now: .. code-block:: xml <error message="failed on setup with &quot;ValueError: Some error during setup&quot;"> Bug Fixes --------- - `1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. - `4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log messages to stderr. - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. - `7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. - `7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` parameter when Python is called with the ``-bb`` flag. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, if the ``autouse`` or ``params`` arguments are also passed, the function is no longer ignored, but is marked as a fixture. - `7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, in rare circumstances where the exact same string is used but refers to different global values. - `7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. Improved Documentation ---------------------- - `7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. - `7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes ------------------------ - `7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not provided explicitly, and is always set. - `7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. - `7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. - `7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. - `7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. - `7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. ``` ### 5.4.3 ``` ========================= Bug Fixes --------- - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` subclasses for skipped tests. ``` ### 5.4.2 ``` ========================= Bug Fixes --------- - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. ``` ### 5.4.1 ``` ========================= Bug Fixes --------- - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. ``` ### 5.4.0 ``` ========================= Breaking Changes ---------------- - `6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. - `6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. - `6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. - `6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - `6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when the result is unavailable, instead of being deleted. If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, set it to ``None`` instead. Deprecations ------------ - `3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and provide feedback. ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). - `571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. It was misaligned since the removal of the ``Directory`` collector in 2010 and incorrect/unusable as soon as collection was split from test execution. - `5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. Instead they are now constructed via ``Node.from_parent``. This transitional mechanism enables us to untangle the very intensely entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. - `6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with ``py.io.TerminalWriter``. Features -------- - `4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. - `5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). - `6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. - `6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements ------------ - `1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. - `449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. - `5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. - `5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. - `6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. - `6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. - `6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. - `6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. - `6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. Users are encouraged to install ``pygments`` into their environment and provide feedback, because the plan is to make ``pygments`` a regular dependency in the future. - `6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. - `759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. Bug Fixes --------- - `310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. - `3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. - `4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. - `5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. - `5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. - `5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. - `6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). The upper case variants were never documented and the preferred form should be the lower case. - `6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. - `6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. The implemented fix replaces `==` with ``is``. - `6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. - `6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. - `6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined in the configuration file. - `6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. - `6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. - `6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. - `6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), a `match` keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). - `6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. - `6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. Improved Documentation ---------------------- - `6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. - `6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes ------------------------ - `6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. ``` ### 5.3.5 ``` ========================= Bug Fixes --------- - `6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. ``` ### 5.3.4 ``` ========================= Bug Fixes --------- - `6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, so the team decided to revert this change and make a new release while we continue to look for a solution. ``` ### 5.3.3 ``` ========================= Bug Fixes --------- - `2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. - `5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the ``multiprocessing`` module. - `6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and parameterized fixtures that execute before them in the fixture stack so they are torn down at the right times, and in the right order. - `6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). Trivial/Internal Changes ------------------------ - `6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. ``` ### 5.3.2 ``` ========================= Improvements ------------ - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. Bug Fixes --------- - `5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. - `6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. - `6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). ``` ### 5.3.1 ``` ========================= Improvements ------------ - `6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. - `6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. Bug Fixes --------- - `5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: pytester: fix :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` when used after positive matching. - `6082 <https://github.com/pytest-dev/pytest/issues/6082>`_: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround to `bpo-17446 <https://bugs.python.org/issue17446>`__. - `6254 <https://github.com/pytest-dev/pytest/issues/6254>`_: Fix compatibility with pytest-parallel (regression in pytest 5.3.0). - `6255 <https://github.com/pytest-dev/pytest/issues/6255>`_: Clear the :py:data:`sys.last_traceback`, :py:data:`sys.last_type` and :py:data:`sys.last_value` attributes by deleting them instead of setting them to ``None``. This better matches the behaviour of the Python standard library. ``` ### 5.3.0 ``` ========================= Deprecations ------------ - `6179 <https://github.com/pytest-dev/pytest/issues/6179>`_: The default value of :confval:`junit_family` option will change to ``"xunit2"`` in pytest 6.0, given that this is the version supported by default in modern tools that manipulate this type of file. In order to smooth the transition, pytest will issue a warning in case the ``--junitxml``…
18: Pin pytest to latest version 6.2.4 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.4**. <details> <summary>Changelog</summary> ### 6.2.4 ``` ========================= Bug Fixes --------- - `8539 <https://github.com/pytest-dev/pytest/issues/8539>`_: Fixed assertion rewriting on Python 3.10. ``` ### 6.2.3 ``` ========================= Bug Fixes --------- - `8414 <https://github.com/pytest-dev/pytest/issues/8414>`_: pytest used to create directories under ``/tmp`` with world-readable permissions. This means that any user in the system was able to read information written by tests in temporary directories (such as those created by the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with private permissions. pytest used to silenty use a pre-existing ``/tmp/pytest-of-<username>`` directory, even if owned by another user. This means another user could pre-create such a directory and gain control of another user's temporary directory. Now such a condition results in an error. ``` ### 6.2.2 ``` ========================= Bug Fixes --------- - `8152 <https://github.com/pytest-dev/pytest/issues/8152>`_: Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - `8249 <https://github.com/pytest-dev/pytest/issues/8249>`_: Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``. ``` ### 6.2.1 ``` ========================= Bug Fixes --------- - `7678 <https://github.com/pytest-dev/pytest/issues/7678>`_: Fixed bug where ``ImportPathMismatchError`` would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). - `8132 <https://github.com/pytest-dev/pytest/issues/8132>`_: Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises ``TypeError`` when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from ``numpy.ndarray``. ``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size. ``` ### 6.2.0 ``` ========================= Breaking Changes ---------------- - `7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only. Deprecations ------------ - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - `7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - `7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - `5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - `7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - `7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - `8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - `1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - `2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - `7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - `7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - `7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - `7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - `7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - `8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - `8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - `4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - `7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - `7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests. - `7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - `8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - `7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference. - `7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - `7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - `7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.) ``` ### 6.1.2 ``` ========================= Bug Fixes --------- - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by `tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation ---------------------- - `7815 <https://github.com/pytest-dev/pytest/issues/7815>`_: Improve deprecation warning message for ``pytest._fillfuncargs()``. ``` ### 6.1.1 ``` ========================= Bug Fixes --------- - `7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. - `7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). ``` ### 6.1.0 ``` ========================= Breaking Changes ---------------- - `5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series 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. Deprecations ------------ - `6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - `7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function 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 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - `7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - `7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. Improvements ------------ - `6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. This also fixes a number of long standing issues: `2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. - `7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. - `7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - `1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python 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 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - `7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - `7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). - `7638 <https://github.com/pytest-dev/pytest/issues/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 ``pytest-xdist``. - `7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - `1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - `7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - `7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. - `7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`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 <https://github.com/pytest-dev/pytest/issues/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 ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. ``` ### 6.0.2 ``` ========================= Bug Fixes --------- - `7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. - `7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. - `7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. - `7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). ``` ### 6.0.1 ``` ========================= Bug Fixes --------- - `7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. Passing ``None`` raises a more informative ``TypeError``. - `7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. - `7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. - `7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. ``` ### 6.0.0 ``` ========================= (**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) Breaking Changes ---------------- - `5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** Following our plan to remove deprecated features with as little disruption as possible, all warnings of type ``PytestDeprecationWarning`` now generate errors instead of warning messages. **The affected features will be effectively removed in pytest 6.1**, so please consult the `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ section in the docs for directions on how to update existing code. In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest ``6.1`` is released. **If you have concerns** about the removal of a specific feature, please add a comment to `5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. - `7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. Features -------- - `7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements ------------ - `7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. - `7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. Bug Fixes --------- - `7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``pytest.mark.skip`` when ``--runxfail`` is used. - `7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. - `7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. - `7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. Improved Documentation ---------------------- - `7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. - `7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. Trivial/Internal Changes ------------------------ - `7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. ``` ### 6.0.0rc1 ``` ============================ Breaking Changes ---------------- - `1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. - `5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in `6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. - `6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) caused an unintended regression by changing the keys returned by ``parseoutcomes()``. Now the API guarantees to always return the plural form, so calls like this: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(errors=1) - `6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. - `7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. Also, ``pytest.Package.name`` is now just the name of the directory containing the package's ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why ``-k`` would match against any directory containing the test suite. - `7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. - `7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` (and similar methods), or ``_pytest.config.create_terminal_writer()``. The following breaking changes were made: - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or ``terminal_writer.flush()``. - Explicit Windows console support was removed, delegated to the colorama library. - Support for writing ``bytes`` was removed. - The ``reline`` method and ``chars_on_current_line`` property were removed. - The ``stringio`` and ``encoding`` arguments was removed. - Support for passing a callable instead of a file was removed. - `7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. - `7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. - `7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. - `7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here for the benefit of plugin authors who may be using it: - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. - Support for zero or multiple arguments to ``Source()`` has been removed. - Support for comparing ``Source`` with an ``str`` has been removed. - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have been removed; use plain ``compile()`` instead. - The function ``_pytest._code.source.getsource()`` has been removed; use ``Source()`` directly instead. Deprecations ------------ - `7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. Features -------- - `1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: .. code-block:: toml pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. - `3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. - `6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. * `--no-summary`: disables the final test summary, including warnings. - `6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. The `--strict-config` flag has been added to treat these warnings as errors. - `6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. - `7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged to try the new mode and provide feedback (both positive or negative) in issue `7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. - `7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. Improvements ------------ - `4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that is printed to stderr when the output of ``pytest`` is piped and and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). - `4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). - `4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. - `6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. - `6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. - `6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. - `6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. - `7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. - `7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. - `7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. - `7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. - `7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the *Captured log report* report section. - `7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. - `7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. Previously: .. code-block:: xml <error message="test setup failure"> Now: .. code-block:: xml <error message="failed on setup with &quot;ValueError: Some error during setup&quot;"> Bug Fixes --------- - `1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. - `4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log messages to stderr. - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. - `7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. - `7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` parameter when Python is called with the ``-bb`` flag. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, if the ``autouse`` or ``params`` arguments are also passed, the function is no longer ignored, but is marked as a fixture. - `7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, in rare circumstances where the exact same string is used but refers to different global values. - `7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. Improved Documentation ---------------------- - `7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. - `7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes ------------------------ - `7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not provided explicitly, and is always set. - `7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. - `7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. - `7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. - `7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. - `7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. ``` ### 5.4.3 ``` ========================= Bug Fixes --------- - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` subclasses for skipped tests. ``` ### 5.4.2 ``` ========================= Bug Fixes --------- - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_parent`` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. ``` ### 5.4.1 ``` ========================= Bug Fixes --------- - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. ``` ### 5.4.0 ``` ========================= Breaking Changes ---------------- - `6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. - `6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. - `6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. - `6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - `6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when the result is unavailable, instead of being deleted. If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, set it to ``None`` instead. Deprecations ------------ - `3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and provide feedback. ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). - `571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. It was misaligned since the removal of the ``Directory`` collector in 2010 and incorrect/unusable as soon as collection was split from test execution. - `5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. Instead they are now constructed via ``Node.from_parent``. This transitional mechanism enables us to untangle the very intensely entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. - `6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with ``py.io.TerminalWriter``. Features -------- - `4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. - `5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). - `6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. - `6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements ------------ - `1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. - `449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. - `5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. - `5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. - `6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. - `6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. - `6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. - `6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. - `6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. Users are encouraged to install ``pygments`` into their environment and provide feedback, because the plan is to make ``pygments`` a regular dependency in the future. - `6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. - `759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. Bug Fixes --------- - `310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. - `3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. - `4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. - `5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. - `5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. - `5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. - `6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). The upper case variants were never documented and the preferred form should be the lower case. - `6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. - `6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. The implemented fix replaces `==` with ``is``. - `6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. - `6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. - `6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined in the configuration file. - `6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. - `6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. - `6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. - `6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), a `match` keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). - `6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. - `6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. Improved Documentation ---------------------- - `6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. - `6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes ------------------------ - `6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. ``` ### 5.3.5 ``` ========================= Bug Fixes --------- - `6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. ``` ### 5.3.4 ``` ========================= Bug Fixes --------- - `6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, so the team decided to revert this change and make a new release while we continue to look for a solution. ``` ### 5.3.3 ``` ========================= Bug Fixes --------- - `2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. - `5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the ``multiprocessing`` module. - `6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and parameterized fixtures that execute before them in the fixture stack so they are torn down at the right times, and in the right order. - `6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). Trivial/Internal Changes ------------------------ - `6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. ``` ### 5.3.2 ``` ========================= Improvements ------------ - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. Bug Fixes --------- - `5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. - `6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. - `6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). ``` ### 5.3.1 ``` ========================= Improvements ------------ - `6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. - `6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. Bug Fixes --------- - `5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: pytester: fix :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` when used after positive matching. - `6082 <https://github.com/pytest-dev/pytest/issues/6082>`_: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround t…
16: Pin pytest to latest version 6.2.4 r=aragilar a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **6.2.4**. <details> <summary>Changelog</summary> ### 6.2.4 ``` ========================= Bug Fixes --------- - `8539 <https://github.com/pytest-dev/pytest/issues/8539>`_: Fixed assertion rewriting on Python 3.10. ``` ### 6.2.3 ``` ========================= Bug Fixes --------- - `8414 <https://github.com/pytest-dev/pytest/issues/8414>`_: pytest used to create directories under ``/tmp`` with world-readable permissions. This means that any user in the system was able to read information written by tests in temporary directories (such as those created by the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with private permissions. pytest used to silenty use a pre-existing ``/tmp/pytest-of-<username>`` directory, even if owned by another user. This means another user could pre-create such a directory and gain control of another user's temporary directory. Now such a condition results in an error. ``` ### 6.2.2 ``` ========================= Bug Fixes --------- - `8152 <https://github.com/pytest-dev/pytest/issues/8152>`_: Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - `8249 <https://github.com/pytest-dev/pytest/issues/8249>`_: Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``. ``` ### 6.2.1 ``` ========================= Bug Fixes --------- - `7678 <https://github.com/pytest-dev/pytest/issues/7678>`_: Fixed bug where ``ImportPathMismatchError`` would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). - `8132 <https://github.com/pytest-dev/pytest/issues/8132>`_: Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises ``TypeError`` when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from ``numpy.ndarray``. ``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size. ``` ### 6.2.0 ``` ========================= Breaking Changes ---------------- - `7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only. Deprecations ------------ - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - `7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - `7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - `5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - `7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - `7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - `8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - `1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - `2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - `7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - `7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - `7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - `7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - `7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - `7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - `8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - `8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - `4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - `7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - `7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests. - `7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - `8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - `7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference. - `7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - `7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - `7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.) ``` ### 6.1.2 ``` ========================= Bug Fixes --------- - `7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - `7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by `tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation ---------------------- - `7815 <https://github.com/pytest-dev/pytest/issues/7815>`_: Improve deprecation warning message for ``pytest._fillfuncargs()``. ``` ### 6.1.1 ``` ========================= Bug Fixes --------- - `7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. - `7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). ``` ### 6.1.0 ``` ========================= Breaking Changes ---------------- - `5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series 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. Deprecations ------------ - `6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - `7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function 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 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - `7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - `7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. Improvements ------------ - `6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. This also fixes a number of long standing issues: `2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. - `7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. - `7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - `7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - `1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python 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 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - `7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - `7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). - `7638 <https://github.com/pytest-dev/pytest/issues/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 ``pytest-xdist``. - `7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - `1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - `7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - `7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. - `7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`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 <https://github.com/pytest-dev/pytest/issues/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 ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. ``` ### 6.0.2 ``` ========================= Bug Fixes --------- - `7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. - `7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. - `7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. - `7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). ``` ### 6.0.1 ``` ========================= Bug Fixes --------- - `7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. Passing ``None`` raises a more informative ``TypeError``. - `7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. - `7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. - `7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. ``` ### 6.0.0 ``` ========================= (**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) Breaking Changes ---------------- - `5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** Following our plan to remove deprecated features with as little disruption as possible, all warnings of type ``PytestDeprecationWarning`` now generate errors instead of warning messages. **The affected features will be effectively removed in pytest 6.1**, so please consult the `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ section in the docs for directions on how to update existing code. In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest ``6.1`` is released. **If you have concerns** about the removal of a specific feature, please add a comment to `5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. - `7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. Features -------- - `7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements ------------ - `7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. - `7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. Bug Fixes --------- - `7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``pytest.mark.skip`` when ``--runxfail`` is used. - `7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. - `7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. - `7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. Improved Documentation ---------------------- - `7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. - `7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. Trivial/Internal Changes ------------------------ - `7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. ``` ### 6.0.0rc1 ``` ============================ Breaking Changes ---------------- - `1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. - `5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in `6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. - `6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) caused an unintended regression by changing the keys returned by ``parseoutcomes()``. Now the API guarantees to always return the plural form, so calls like this: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: .. code-block:: python result = testdir.runpytest() result.assert_outcomes(errors=1) - `6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. - `7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. Also, ``pytest.Package.name`` is now just the name of the directory containing the package's ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why ``-k`` would match against any directory containing the test suite. - `7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. - `7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` (and similar methods), or ``_pytest.config.create_terminal_writer()``. The following breaking changes were made: - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or ``terminal_writer.flush()``. - Explicit Windows console support was removed, delegated to the colorama library. - Support for writing ``bytes`` was removed. - The ``reline`` method and ``chars_on_current_line`` property were removed. - The ``stringio`` and ``encoding`` arguments was removed. - Support for passing a callable instead of a file was removed. - `7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. - `7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. - `7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. - `7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here for the benefit of plugin authors who may be using it: - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. - Support for zero or multiple arguments to ``Source()`` has been removed. - Support for comparing ``Source`` with an ``str`` has been removed. - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have been removed; use plain ``compile()`` instead. - The function ``_pytest._code.source.getsource()`` has been removed; use ``Source()`` directly instead. Deprecations ------------ - `7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. Features -------- - `1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: .. code-block:: toml pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. - `3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. - `4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. - `6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. * `--no-summary`: disables the final test summary, including warnings. - `6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. The `--strict-config` flag has been added to treat these warnings as errors. - `6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. - `7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged to try the new mode and provide feedback (both positive or negative) in issue `7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. - `7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. Improvements ------------ - `4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that is printed to stderr when the output of ``pytest`` is piped and and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). - `4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). - `4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. - `6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. - `6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. - `6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. - `6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. - `7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. - `7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. - `7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. - `7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. - `7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the *Captured log report* report section. - `7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. - `7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. Previously: .. code-block:: xml <error message="test setup failure"> Now: .. code-block:: xml <error message="failed on setup with &quot;ValueError: Some error during setup&quot;"> Bug Fixes --------- - `1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. - `4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log messages to stderr. - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. - `7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. - `7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` parameter when Python is called with the ``-bb`` flag. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, if the ``autouse`` or ``params`` arguments are also passed, the function is no longer ignored, but is marked as a fixture. - `7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, in rare circumstances where the exact same string is used but refers to different global values. - `7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. Improved Documentation ---------------------- - `7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. - `7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes ------------------------ - `7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not provided explicitly, and is always set. - `7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. - `7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. - `7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. - `7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. - `7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. ``` ### 5.4.3 ``` ========================= Bug Fixes --------- - `6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. - `6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. - `6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. - `7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. - `7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` subclasses for skipped tests. ``` ### 5.4.2 ``` ========================= Bug Fixes --------- - `6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. - `6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. - `6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. - `6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. - `6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. - `6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. - `7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. - `7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_parent`` so it forwards extra keyword arguments to the constructor. - `7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. - `7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. ``` ### 5.4.1 ``` ========================= Bug Fixes --------- - `6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``pytest.mark.parametrize`` to be explicitly defined in the function signature. The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. - `6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. ``` ### 5.4.0 ``` ========================= Breaking Changes ---------------- - `6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. - `6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. - `6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. - `6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - `6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when the result is unavailable, instead of being deleted. If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, set it to ``None`` instead. Deprecations ------------ - `3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and provide feedback. ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). - `571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. It was misaligned since the removal of the ``Directory`` collector in 2010 and incorrect/unusable as soon as collection was split from test execution. - `5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. Instead they are now constructed via ``Node.from_parent``. This transitional mechanism enables us to untangle the very intensely entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. - `6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with ``py.io.TerminalWriter``. Features -------- - `4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. - `5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). - `6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. - `6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements ------------ - `1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. - `449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. - `5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. - `5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. - `6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. - `6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. - `6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. - `6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. - `6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. Users are encouraged to install ``pygments`` into their environment and provide feedback, because the plan is to make ``pygments`` a regular dependency in the future. - `6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. - `759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. Bug Fixes --------- - `310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. - `3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. - `4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. - `5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. - `5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. - `5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. - `6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). The upper case variants were never documented and the preferred form should be the lower case. - `6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. - `6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. - `6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. The implemented fix replaces `==` with ``is``. - `6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. - `6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. - `6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined in the configuration file. - `6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. - `6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. - `6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. - `6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), a `match` keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). - `6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. - `6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. Improved Documentation ---------------------- - `6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. - `6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes ------------------------ - `6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. ``` ### 5.3.5 ``` ========================= Bug Fixes --------- - `6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. ``` ### 5.3.4 ``` ========================= Bug Fixes --------- - `6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, so the team decided to revert this change and make a new release while we continue to look for a solution. ``` ### 5.3.3 ``` ========================= Bug Fixes --------- - `2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. - `5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the ``multiprocessing`` module. - `6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and parameterized fixtures that execute before them in the fixture stack so they are torn down at the right times, and in the right order. - `6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). Trivial/Internal Changes ------------------------ - `6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. ``` ### 5.3.2 ``` ========================= Improvements ------------ - `4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". The warning proved to be less useful than initially expected and had quite a few false positive cases. Bug Fixes --------- - `5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. - `6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. - `6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). ``` ### 5.3.1 ``` ========================= Improvements ------------ - `6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. - `6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. Bug Fixes --------- - `5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: pytester: fix :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` when used after positive matching. - `6082 <https://github.com/pytest-dev/pytest/issues/6082>`_: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround to `b…
…3.2.1 Alexandre Gramfort (13): ENH : adding support for some FreeSurfer files STY: missing ending line ENH : adding freesurfer to setup.py ENH : adding nibabel.freesurfer.tests to setup.py ENH: using nose.assert_true ENH : removing freesurfer.io.read_scalar_data now that MGH format is properly handled FIX : fix the read_annot when parcellation has missing values and orig_ids=False. FIX : handle versions of fsaverage FIX : dtype pb with annot on numpy 1.5.1 add test + misc address comments address comments don't count warnings Anibal Sólon (11): make sure cov is installed pytest port drop the nose finish porting gifti module tests to pytest make sure cov is installed test script condition reintroduce nosetests into matrix remove unnecessary dependency pytest is already tested nose test inclusions windows breaklines..? Ariel Rokem (27): BF: Use newer call to frombytes, replacing fromstring. PEP8 Add pillow to dependencies, add old pillow to test with old pydicom. Test with PIL on old Python. Compatibility with older versions of PIL that don't have frombytes. Revert back to older pillow, since PIL is a pill. TST: If a file doesn't exist, we want an informative error. RF: Add testing for file existence up front. TST: Use IOError for Python 2 support. Use FileNotFoundError. Implement in py3k for Python 2 compatibility. PEP8 TST: Add testing on Python 3.5 on Appveyor. Explicitly create a conda environment for the test, specify Python version. Separate things out a bit, set always-yes for conda. Test on Python 3.5 with 32 architecture, to see if that matters. TST: Make sure that img.__getitem__ exception throws the right error. RF: Usually indexing is done with an indexing item. TST: Add explanatory comment. RF: Make idx a positional argument. Fix in coordinate_systems tutorial RF: Circumvents a deprecation warning from `np.fromstring` RF: fromstring => frombuffer in externals.netcdf. RF: fromstring => frombuffer in gifti/cifti2 RF: fromstring => frombuffer. BF: Use a writeable bytearray for the header data. NF: Implement a `readinto` method for Opener. Don't refcheck on this resize, to avoid errors B. Nolan Nichols (7): updated image_orient_patient function few updates to naming conventions for edicom sequences - e.g., PixelMeasuresSequence instantiate superclass in MultiframeWrapper __init__ added is_edicom flag fixed sop class comparison PL: updated docstring quotes and other recommended changes RF+TST: updated multiframe error handling and tests Bago Amirbekian (4): BF - fix RGB read issue + test TEST - set imdtype with code+npt TEST - added test for set_qform and set_sform BF - only check dtype min-max is clip is needed Basile Pinsard (5): fix decimal rescale values causing Decimal data frame adding comment about float casting fix endian value in gifti fix b64encoding for no newline in outputs fixes + backcompat test Ben Cipollini (144): Add an 'axis' parameter to concat_images, plus two tests. Try again, this time with lists and more tests... Add greater coverage of different shapes. Make this work for all 3D and 4D combinations possible, across all axes possible. Test extensively. Allow mixed files and objects. Improve efficiency: load img0 once, del reference, and don't check affine on first image. Add a final comment. Code reorganization, comment editing. Remove 3D/4D special-case code. Fix broadcasting bug (img1.shape == (1,2,3), img2.shape=(1,2,1), axis=None would broadcast rather than error) Similar bug in axis=int pathway, due to np.concatenate "smartness". Test 2D - 5D; remove some tests to increase speed. Convert exceptions to string. Remove default argument. Small code review tweaks. Fix for #324 - use consistent syntax for have_scipy. Change idioms for selecting the 2nd output arg. Simplify idioms, delete unnecessary 'global' definition. Linting nifti1.py Allow classes to register extensions with opener functions; use this for .mgz. Remove .mgz-specific logic from BinOpener, and deprecate. Use Opener (which contains .mgz) instead of BinOpener (which is no longer needed). Move decorator to ImageOpener, use ImageOpener. register_extension => register_ext_from_image Add simple tests for adding a new file association. Add test for BinOpener deprecation. Tweak docstrings / parameter name. New interface: suppress_warnings, clear_and_catch_warnings, and error_warnings. Unlike numpy, default to record=True (this is what we had before). Add deprecation tests Fixing test failures. Deprecate the use of class_map and ext_map. Migrating imageclasses, away from IMAGE_MAP Improve error handling, efficiency, and search more broadly over header extensions. Modify save, remove vestigates of class_map / ext_map Code cleanup after self code review, fix for Python 3 'filter' issue. Remove references to BinOpener Linting, cleaning up logic. Adding tests for loading each image type. Add back analyze header tests. sniff_size => sizeof_hdr Simplify is_image test. RF: getArraysFromIntent => get_arrays_from_intent RF: make meta, numDA, and labeltable into properties. TST: Add LabelTable test, test cleanup Add get_/set_ function deprecations and deprecation tests. get_metadata => metadata get_rgba => rgba TST: Add tests for darrays / numDA BF: can't use assert_raises as context (py2.6) Add tests for rgba, clean code. Check NumberofDataArrays, warn only if it's wrong. Add tests, change print error to ValueError, test it ValueError=>TypeError Tweak error message, add all TypeError tests, localize properly. Make sure xml is encoded as utf-8 RF: convert xml code to use xml library. Move to XmlSerializable interface. RF: add thin layer around xml.etree.ElementTree and share XmlSerializable RF: remove data_tag deprecate gifti.data_tag deprecate (not delete) to_xml_start, to_xml_end RF: Create abstract FileBasedImage / FileBasedHeader classes. RF: combine BaseHeader/Image with FileBasedHeader/Image. RF: Header=>SpatialHeader get_header => header; deprecate get_header Fix filebasedimage docstring. basestring => six.string_types Remove any mention of affine or dataobj from FileBasedImage make from_image an abstract method Syncing up with code changes to spatialimages.py that occurred while I was doing this PR. Make Gifti extend FileBasedImage, implement from_file_obj, to_file_obj. Deprecate giftiio STY: Ignore output of coverage --html Make GIFTI call superclass __init__ Code cleanup for @effigies code review. xmlutils.py => xmlbasedimages.py Base GiftiImage on XmlBasedImage Use gifti's to_file_map as XmlBasedImage's default implementation. Create a new XmlImageParser abstract class, which must be implemented and attached to each XmlBasedImage subclass. Implement GiftiImageParser, stamp on GiftiImage Fix: GiftiImage should use get_/set_filename Properly deprecate Outputter, parse_gifti_file BF: re-implement buffer size; makes parsing faster! TST: Add parse_gifti_fast deprecation tests (and fix old deprecation tests) Use verbose=1 instead of global DEBUG_PRINT flag STY: linting parse_gifti_fast STY, DOC: linting, documentation. Allow buffer_size=None, to avoid setting explicitly. FIX: xmlbasedimages Remove XmlBasedImage, xmlbasedimages.py=>xmlutils.py Deprecate (not delete) Outputter.initialize. Match previous interface for Outputter, add back minimal docstring. DOC: Add six copyright (#375) DOC: fix openhub.net badge (#378), prevent overflow of sidebar content. DOC: change URL to numpy docstring style guide (partial fix for #376) DOC: include all copyright information in greyed box. BF: Fix #362 using buffered gzip read. TST: add image tests in large image test. TST: Add a runif_extra_has decorator. DOC: updates for code review. BF: Only define code change in Py3.5.0; only use if needed. TST: Fix logic to check test values, use ones instead of zeros (zeros returned data read/copy fails). STY: code changes per code review. DOC: add documentation of advanced testing. STY: autopep8 on source code. STY: autopep8 on test code. STY: autoflake on source code. STY: autoflake on test files. update tox STY: flake8 manual fixes BF: fix bug in mriutils use of __all__ STY: manual fixes to autopep8 TST: add flake8 of core nibabel code to TravisCI TST: remove unnecesary checks, document necessary checks BF: files must be makeable (they're made!) for this test. save conversion logic is not as strong as needed (should really use maybe_is_image). Use some try...catch to safeguard. Localize Cifti to /cifti; use nib.load/save ENH: add xmlutils.XmlParser Use _to_xml_element, snake_case properties, remove numXXX props, never return empty when xml requested. Use assert_equal(a,b) instead of assert_true(a==b) fix: move intent_codes. fix: no xmlimage STY: pep8 updates Add a write_morph_data function. Add a write_morph_data function. cifti=>cifti2, Cifti=>Cifti2 FIX: Take care of byte vs. string / BytesIO vs. StringIO encodings for Python 3. deprecation tests should actually test for warnings. data arrays created via constructor are malformed; create via from_array. Do not declare class variables as types; they mask failure to set instance-level variables. make num_dim a read-only property STY: fix up pep8 failures. TST: add gifti string and MetaData tests. Add a write_morph_data function. BF: files must be makeable (they're made!) for this test. save conversion logic is not as strong as needed (should really use maybe_is_image). Use some try...catch to safeguard. Localize Cifti to /cifti; use nib.load/save Use _to_xml_element, snake_case properties, remove numXXX props, never return empty when xml requested. Use assert_equal(a,b) instead of assert_true(a==b) fix: move intent_codes. fix: no xmlimage STY: pep8 updates cifti=>cifti2, Cifti=>Cifti2 FIX: Take care of byte vs. string / BytesIO vs. StringIO encodings for Python 3. Benjamin C Darwin (1): test_proxy_api: replace nonexistent `extend` method call on a tuple with `+=` Bennet Fauber (2): set sform with set_sform not get_sform two withs become one Bertrand Thirion (1): removed dependence on functools.reduce Brendan Moloney (22): BF+TST - Allow 0 len items in CSA hdr if VM != 0 BF: Only use the cross product (possibly negated) for the slice normal. DOC: Added some comments to clarify what is going on. TST: Make sure the slice normal is sufficiently orthogonal, even when CSA slice normal is not. TST: Additional tests for getting slice normal from DicomWrapper ENH: Added funtions to transform orientations. DOC: Fixed typo in axcodes2ornt docstring BF: ornt_transform was returning the inverse of the correct orientation. TST: Added test for decimal rescale issue. ENH: Handle 4D+ datasets. ENH: Improve get_data for 4D+ multiframe BF+TST: Fixed lookups for iop/ipp/pixspacing TST: Add test data for previous commit TST: Point multiframe test at correct file. TST: Add test that makes sure resulting data order doesn't change for 4D multiframe. CMP: Fix Python3 incompatability in last commit. DOC: Added info about how blocks of private elements are reserved DOC: Improve description of private block reservation. BF+TST: Skip over missing CSA header elem instead of raising. RF: Move dicom import into test function RF: Skip test for python < 2.6 and pydicom < 1.0 ENH: Add parser for Siemens "ASCCONV" text format Cameron Riddell (15): load save with pathlib.Path objects Add fn to coerce pathlike to string Insert _stringify_path to entry points Refactor _stringify_path to filename_parser.py resolve flake8 testing for pathlib purge basestring move stringify guard to types_filenames update docstrings to accept str or os.PathLike update _stringify_path doc update docstrings to accept str or os.PathLike mghformat accept pathlib for filespec_to_file_map tests pathlib compatible update _stringify_path doc Fix flake 8 issues Carl Gauthier (1): DOC: Fixed a typo Christian Haselgrove (6): Import the data format tools dicomfs fixes regarding encoding and other bits. removed explicit tags (in favor of dicom object attributes) importing dft from nibabel dft tests and test data templating HTML output Christopher J. Markiewicz (757): Add writing capabilities for freesurfer triangle files Use more modern tempfile methods, ensure tests run, improve writing Add default timestamp behavior to write_geometry NF: Write capabilities for freesurfer triangle files TEST: Use portable getpass.getuser(); use InTemporaryDirectory BF: Use portable getpass.getuser() in write_geometry STY: pep8 clean ENH Add read_scalars parameter to freesurfer.read_label() (used in PySurfer) BF Add parameter to freesurfer.read_label TEST Simple validation of freesurfer.read_label behavior BF Add correct parameters to test Use HTTPS for outside scripts/forms DOC http->https where both work and have same content DOC: Update URLs with non-trivial changes NF: Automatically reshape FreeSurfer ico7 niftis TEST: FreeSurfer ico7 surface NIfTI hack TEST: Update nitest-freesurfer submodule STY: Remove blank lines from test_freesurfer_ico7_hack BF: Use deprecate_with_doc as decorator BF: Fix benchmark range bounds PEP8/PyFlakes cleanup of nibabel/ (tests pass) PEP8/PyFlakes cleanup of nibabel/*/ excluding tests (tests pass) BF: FreeSurfer nifti surfaces can have >3 dimensions TST: Call current python executable TEST/BF: Test cases skipped; STY: PEP8 TEST: Update out_tup to what is expected TEST: Clarify test_qform_sform test BF: Misplaced parenthesis TST: Verify pixdim check for non-negative values RF: Begin refactoring load into image classes Relegate slicing to is_header, remove _minctest TST: Remove Minc1Header exception STY: Unnecessary try block, comment lines too long TST: Test ValueErrors raised by is_header RF: Rename is_header to may_contain_header RF: Restore and deprecate loadsave helpers TST: Kill extra test; doc string to comment RF: Prefer alternate_exts over abusing files_types DOC: Deprecation warnings to stacklevel 2 STY: Remove misleading 'sizeof_hdr' from Minc1/2 RF: Tag sniffs with file name RF: Fail quietly on too-short header blocks TEST: path_maybe_image part of image API BF: Set strided_scalar as not writeable STY: PEP8 cleanup valid_exts is no longer used DOC: Add usage to ImageOpener docstring STY: PEP8 and import cleanup BF: Prepare for pydicom 1.0 TST: Travis with pydicom > 0.9.9 git commit TST: Add sdist, wheel & requirements INSTALL_TYPEs TST: Add large nifti file test ENH: Support calling Sphinx with Python 3 DOCTEST: Python 3 fixes DOCTEST: Use texext 0.3 DOC: Update docs from 2.0.2 release DOC: Add maintainer, escape $ in RST DOC: Update website/mailing list TST: Run style tests separately RF: Switch to locally-defined underscore function BF: Update Cifti2Label._to_xml_element TST: Exercise Cifti2 classes more thoroughly BF: Add label_table to named_map structure DOC: Update write_morph_data docstring TST: Test morph_data round trip DOC: Update docstring RF: Enable writing morphometry data to file-like objects TST: Test dimension, size, and fnum constraints TST: Restrict accepted shapes to plausible vectors TST: Skip big array check on 32-bit systems DOC: Update docstrings TEST: Actually test oldest matplotlib DOC: Fieldtrip moved from Google Code to GitHub NF: Handle metadata in read/write_geometry BF: Coerce parsed GiftiDataArray.ext_offset to int TEST: Test default types for parsed Gifti files BF: Handle empty strings in ExternalFileOffset RF: Switch to locally-defined underscore function BF: Update Cifti2Label._to_xml_element TST: Exercise Cifti2 classes more thoroughly BF: Add label_table to named_map structure DOC: Update docstrings Address comments TEST: Move shape API tests into DataInterfaceMixin Update authors Add new release skeleton to Changelog Summarize changes since 2.1.0 Update .mailmap Replace execfile with runpy (2.7 & 3.2+) PR 504 not merged yet Import BytesIO from io where possible Add ArrayProxy.reshape Typo Cifti2 arrayproxy tests should be negated or dropped... RF: Do not automatically load data CIFTI data Severely simplify _Cifti2AsNiftiImage Permit tuple ArrayProxy spec in place of header ArrayProxy.reshape generates headerless ArrayProxy RF: Deprecate ArrayProxy.header to be removed in 3.0 TEST: Test tuple specs and reshaped APs Update Changelog DOC: Update ArrayProxy docstrings RF: Update ArrayProxy.reshape to take -1 entries FIX: Correct reshape method TEST: Catch warning, test -1 reshaping TEST: Check for illegal specs TEST: Check legal but incompatible shapes Update pre-release changelog Update authors, mailmap Update numpy minimum version RF: Derive affine in SpatialImage.transpose Update docs, function name DOC: Update changelog, authors DOC: Update Changelog to include pr/551 DOCTEST: Use legacy float array printing for now STY: Hide testsetup from docs TEST: Create and import setup_test fixture into affected files ENH: Update min numpy version for legacy print TEST: Import test_setup into module __init__ STY: Ignore unused import DOC: Update author list REL: Update version for final tests DOC: Credit doc fixes DOC: Update Changelog TEST: Use label file that exists across FS versions 2.2.0 Changelog Start 2.2.x maintenance branch Bump dev version FIX: Set L/R labels in orthoview correctly TEST: Check only relevant warnings STY: Narrow exception check STY: No bare excepts Reset maintenance version MAINT: Update changelog, authors MAINT: Remove -dev from version MAINT: Bump dev version for 2.2.x FIX: Use SSH address to use key-based auth FIX/ENH: get/set_data_shape more robustly RF: Subclass MGHHeader from LabeledWrapStruct RF: Remove one-line private method FIX: goodRASFlag check, update RF: Remove unused _load_cache FIX: Label x/y/z_ras correctly RF: Make direction cosines explicit, not transposed RF: Pxyz_c to c_ras RF: Simplify to/from affine Rename goodRASFlag -> ras_good FIX/TEST: MGHImages must be 3D or 4D RF: delta -> voxelsize; simplify conversion code TEST: Update tests for refactor DOC: Annotate header fields RF: Improve footer handling ENH: Return TR as 4th zoom for 4D images RF: Reset zooms to 1 on reshape TEST: Footer; FIX: Simplify defaults FIX: Python 2 division TEST: Missing functionality tests ENH/DOC: Update and document get/set_zooms RF: Simplify affine conversion code ENH: Check for expected byte order ENH: Re-add _header_data with deprecation warning FIX: Return on get, not on set REVERT renamed/reshaped header fields RF/TEST: Check endianness rather than ignoring RF: Remove endianness, override copy, as_byteswapped, diagnose_binaryblock FIX: Do not double-set attributes TEST: TestWrapStruct features, set_zooms, deprecated fields TEST: Add and test version check TEST: Test MGHHeader._HeaderData fully STY: Typo DOC: Add reference to FreeSurfer wiki STY: Whitespace STY: Remove spaces after final newline TEST: Test angle_axis2mat(is_normalized=True) TEST: Check keep_file_open="auto" TEST: Test deprecation, ornt_transform error condition TEST: Test voxel size padding TEST: Check invalid caching argument for get_fdata FIX: hasattr uses getattr, not __hasattr__ TEST: Test package info functions TEST: Test from_header(check=False) ENH: data shape check preempted by update_header FIX: Give Windows time to decide files are closed Revert "FIX: Give Windows time to decide files are closed" TEST: Delete arrayproxies, allowing Windows to close filehandles COV: Omit tests, drop obsolete omissions CI: Remove duplicate Travis entry [skip ci] DOC: Update Changelog REL: Update version DOC: Update copyright, contributors DOC: Update changelog pre-emptively DOC: Another pre-emptive changelog entry ENH: Add funcs.crop_image ENH: crop_image to bounds, adding margin STY: Do not capture exception in variable ENH: Permit cropping with negative indices, give more specific errors TEST: Initial crop_image test ENH: Enable SpatialImage.{slice,__getitem__} ENH: Enable minimally-fancy indexing RF: Move to img.slicer approach RF: Simplify affine transform REVERT fileslice modifications ENH: Add SpatialImage._spatial_dims slicer RF: Move slicer validation into image RF: Remove crop_image (for now) FIX: Type check, _check_slicing arguments ENH: Handle new axes in Minc TEST: Image slicing Translate ValueErrors to IndexErrors when used TEST: Handle MGHFormat (max: 4D) correctly TEST: Test single-element list indices RF: All SpatialImages are makeable TEST: Check step = 0 case ENH: Drop fancy indexing TEST: Test single-slice and fancy indexing raise errors DOC: Changelog entry TEST: Do not use deprecated _header_data DOC: Link to aliasing wiki article [skip ci] ENH: Improve exception message RF: Specify spatial dims in each class TEST: Check for _spatial_dims TEST: Minor fixes RF: Switch to spatial_axes_first RF/TEST: Purge _spatial_dims and related tests RF: Move slicing machinery to SpatialFirstSlicer class ENH: Raise IndexError on empty slices TEST: Update slice_affine test, check zero slices RF: Fuse only available on systems with getuid DOC: Some clarifying comments in SpatialFirstSlicer DOC: Update changelog to include gh-614 DOC: Update changelog Bump dev version MAINT: 2.4.0-dev DOC: Update changelog with release date DOC: Update changelog with release date TEST: Ensure warning isn't suppressed CI: Test on Python 3.7 on Travis CI: Use dist xenial CI: Use matrix include for Python 3.7 CI: Use Python 3.7-dev DOCTEST: FutureWarning repr changed in 3.7 CI: Use 3.7 proper, move trusty+3.4 to matrix TEST: Catch warnings in clear_and_catch tests CI: Add Python 3.7 to AppVeyor matrix FIX: Annotation labels are RGB, no alpha TEST: Update tests to use RGB only DOC: Update ctab documentation, comments CI: Drop extraneous 2.7 build on Travis DOC: Update Changelog MNT: .mailmap MAINT: Drop -dev MNT: Update YOH, CC initials TST: Require hypothesis>=3.7 STY: Break overly-long line ENH: Add ndim to ArrayProxy protocol TEST: Validate expected ndim behavior ENH: Pass ndim through to DataobjImage TEST: Validate DataobjImage.ndim Revert "TST: Require hypothesis>=3.7" DOC: Update changelog Update changelog REL: 2.3.1 MNT: 2.3.2-dev Update changelog on master MNT: Remove deprecate numpy.asscalar STY: Flake8 3.6+ cleanup FIX: Immutable buffers should not be set writeable Revert "FIX: Immutable buffers should not be set writeable" MAINT: Add bz2file dependency for Python 2 RF: Drop SAFE_STRINGERS, depend on bz2file to provide .readinto() CI: Upgrade setuptools MAINT: Move to setuptools exclusively FIX: Use bz2file for Python 2 FIX: Rely on openers.BZ2File to provide correct class CI: Upgrade pip, setuptools, wheel on AppVeyor TEST: fobj string assumptions need only apply to bytearrays FIX: Load TckFile streamlines using bytearray TEST: Return mutable bytearray from trk_with_bytes FIX: Truncate buffer on EOF CI: Try alternative pip install MAINT: Bump -dev version FIX: Use io.BytesIO to test TckFile STY: Drop unused variable RF: Leave nisext alone, pop install_requires DOC: Add a comment explaining readinto/frombuffer idiom DOC: Update changelog DOC: Update authors, copyright year MAINT: Version 2.3.2 Update nibabel/cifti2/cifti2.py Update nibabel/externals/oset.py MAINT: Add six dependency CI: Improve Travis test conditions MAINT: Bump maintenance version DOC: Update changelog REL: 2.3.2 DOC: Changelog typos MAINT: Bump dev version RF: Reduce concatenations further, moderate cleanups FIX: Return to bytearray/frombuffer approach FIX: Check final delimiter is ONLY infs TEST: Simple load test for matlab_nan.tck STY: Reduce diff RF: Restore missing streamline delimiter error STY: Pacify flake8 RF: Move setup_test to nibabel/__init__.py RF: Use pkgutil to avoid importing nose RF: Check for mock using pkgutil FIX: Import numpy in setup_test FIX: Ensure nose can be imported during mock test TEST: Extending ArraySequences corrupts sliced data CI: Run coverage on as many tests as possible RF: Use _safe_resize helper function CI: Ignore tests, benchmarks and externals for Codecov CI: Restore coverage config, remove codecov config CI: Run coverage on Windows MNT: Drop coveralls - redundant with codecov and poorly configured DOC: Add Zenodo badge to README MNT: Add .zenodo.json, tool to sort by commits MNT: Sort .mailmap TEST: Move test DICOMs into nicom/tests/data TEST: Restore dicom files used for DFT MNT: Last, First name MNT: Update zenodo metadata, re-sort RF: Remove unnecessary try guard DOC: Changelog skeleton MNT/DOC: Update mailmap, zenodo, author list MAINT: Version 2.4.0 TEST: Check world direction of encoding remains consistent RF: Use list comprehension in reordering ENH: Add NIFTI_XFORM_TEMPLATE_OTHER xform code MNT: Update author list, mailmap, zenodo DOC: Update changelog Apply suggestions from code review MNT: Bump minimum numpy version to 1.8 TEST: Add de-identified, compressed DICOM with empty string in SliceThickness field CI: Attempt to use virtualenv on Windows CI: Use pypiwin32 over pywin32 Apply suggestions from code review CI: Maybe no update to pywin32 is needed? Update nibabel/cifti2/cifti2.py Apply suggestions from code review DOCTEST: Drop doctest SKIP directives FIX: Use other.volume_mask to index other.voxel DOC: Update docstrings with a few more links and array_like DOC: Update changelog, zenodo DOC: Add Matt Cieslak to author list MNT: Bump version to 2.4.1dev MNT: Bump version to 2.5.0dev DOC: Update Sphinx config to support recent Sphinx/numpydoc TEST: Verify writing to loaded data array fails RF: Decode B64* data to bytearrays for writable numpy arrays MAINT: Update Zenodo, Changelog with errors/missing info FIX: Replace invalid MINC1 file with fixed file TEST: Check for competing actions on warning filters FIX: Safer warning registry manipulation when checking for overflows RF: Use catch_warnings context managers to catch overflow TEST: Clarify comments MAINT: Pacify upstream Deprecation/FutureWarnings RF: De-duplicate - the vulnerable window stays small TEST: Use realistic data in test, loop to ensure interference MAINT: Deprecate keep_file_open == "auto" (scheduled for 2.4.0) TEST: Test mmap parameter acceptance RF: Move mmap/keep_file_open parameters to DataobjImage.from_file* FIX: Pass kwargs from Cifti2.from_file* to Nifti2.from_file* FIX: Accept mmap keep_file_open for Ecat and Minc, with no effect DOC: Update changelog, author list TEST: Verify we can write files with repeated labels FIX: Correctly write .annot files with duplicate labels TEST: Add round-trip test DOC: Update long description to include CIFTI-2, BRIK/HEAD DOC: Update changelog DOC: Update author list DEP: Deprecate nibabel.trackvis, effect old FutureWarning threats DEP: Transition checkwarns to deprecations and set target version DEP: Transition minc module to deprecated, announce 3.0 removal DEP: Promote catch_warn_reset FutureWarning to DeprecationWarning TEST: Use old-style assert_warns TEST: Create a test file for scheduling removals MAINT: Set name to nibabel in setup.py MNT: Bump version to 2.4.2dev TEST: Generalize, schedule nibabel.checkwarns removal TEST: Verify ImportError, add object removal schedule, schedul trackvis removal PY2: No importlib CI: Fix AppVeyor codecov paths FIX/TEST: Numpy casting rules have gotten more strict, raise different exception ENH: Add FileBasedImage.serialize() DOC: FileBasedImage.serialize.__doc__ FIX: Import io ENH: Test serialize via an API test mixin RF: Rename serialize to to_bytes, add from_bytes RF: Factor SerializableImage TEST: Generate file when no examples available TEST: klass sometimes missing, equality sometimes undefined ENH: Add to/from_bytes interface to GiftiImage TEST: Delete images so mmapped files can be removed DOC: Improve docstring FIX: Nifti1Image is serializable, not Nifti1Pair ENH: Check for multi-file images, to ensure well-defined behavior TEST: Move special case header equality check into TestSerializableImageAPI STY/DOC: Note about multi-file images, newline MAINT: Full-speed setuptools MAINT: Restore reading version from info.py PY2: ConfigParser for Sphinx build WIN: Drop .bat suffix for scripts MAINT: externals/tests/data skipped in sdist MAINT: Add minimum setuptools version to setup.py CI: Test minimum setuptools MAINT: Add pyproject.toml to give setuptools hint MAINT: Add wheel requirement on-the-fly, improve comments TEST: Add multiframe ECAT file for testing FIX: Minor ECAT cleanups DOC: Update changelog for upcoming 2.5.0 release MAINT: Version 2.5.0 FIX: Set TRK byte order to < before filling values PY3: Use next function on iterator while checking ECAT affines DOCTEST: Display system endianness-neutral representation of <i2 TEST: Use package-wide setup and teardown to adjust numpy print options MAINT: Use a more general _test_state structure for setup/teardown Apply suggestions from code review ENH: Pass endianness as parameter to TrkFile._default_structarr DOC: Update changelog MAINT: Update mailmap, Zenodo REL: 2.5.0 MAINT: 2.5.1-dev MAINT: 3.0.0-dev MAINT: Add community guidelines DOC: Update docstring standard DOC: Contributing guide, mostly linking to docs DOC: Drop covenant boilerplate DOC: Add Matthew Brett as point of contact CI: Add Azure Pipeline for Python 3.5 CI: Remove AppVeyor AZURE: Environment reset at each step AZURE: Virtualenvs do not seem to work as expected AZURE: Fix step name AZURE: Expand matrix to Python 3.4-3.7, x86 and x64 CI: Test installing from git archive CI: Drop 2.7, 3.4 tests from Travis MAINT: Update dependencies for Python >= 3.5 MAINT: Add update_requirements.py; update requirements FIX: Update minimum six FIX: Need numpy 1.12 for fixed assert_warns MAINT: Purge __future__ RF: Drop six.*metaclass RF: Drop six.*IO RF: Drop six.moves RF: Drop six.*_types MAINT: Drop nibabel.externals.six MAINT: Drop six dependency RF: Drop code explicitly tagged as PY2 RF: Drop python < 3.5.1 hacks in openers TEST: Duplicate assertion DOC: Update docstrings without Py2/3 discussion RF: Remove Python < 3.5 hacks TEST: Drop BZ2 mio error checks (Python 3.3 only) RF: Use builtin FileNotFoundError STY: Unused import RF: Import from numpy.compat.py3k when needed TEST: Minimum numpy >= 1.12 DOC: Minimum Python == 3.5.1 MAINT: Set up versioneer MAINT: Drop COMMIT_INFO RF: Drop old __version__ RF: Move all version play from info to pkg_info MAINT: Add fallback version to versioneer + git-archive TEST: Test fallback version VERSIONEER: Improve short version file handling MAINT: Ignore _version.py in coverage MNT: Deprecate DataobjImage.get_data, schedule for removal in 5.0 CI: Drop separate indexed_gzip test STY: Configure pep8speaks DATA: Add nibabel-data/nitest-dicom submodule TEST: Update test DICOM file location MNT: Update extras CI: Refactor Travis to separate steps more cleanly, use extras to for dependencies MNT: setup_egg.py now unused Trigger CI CI: Add expected failing test CI: Temporarily drop all other tests ENH: Require h5py 2.10 for Windows + Python < 3.6 TEST: Import have_h5py and similar from nibabel.minc2 FIX: More robust floating point dtype check Revert "CI: Temporarily drop all other tests" CI: Require binaries for 3.4 as dependencies stop building wheels RF/TEST: Move h5py compatibility hacks into a private module DOC: Update docstrings to describe affine property CI: Add expected failing test to Azure ENH: Add general test data retriever DOCTEST: Retreive a surface file using test_data DATA: Add 10 time point time series GIFTI in fsaverage3 space TEST: Test new test_data function TEST: Check for failing GIFTI encodings FIX: Coerce data types on writing GIFTI DataArrays MAINT: Check nightly builds on 3.7 MAINT: Check nightly builds on 3.7 TEST: Reproduce gh-802 ENH: Remove img.get_data() from internal use except for appropriate tests DOC: Update test_image_api docstring for clarity, consistency DOC: Update changelog for upcoming 2.5.1 release MAINT: Version 2.5.1 MAINT: Update zenodo.json DOC: Add Henry Braun to contributor list MAINT: Update setup.cfg nose version to match installation instructions MAINT: 2.5.2-dev Re-import externals/netcdf.py from scipy DOCTEST: Avoid fixed ID in doctest DOCTEST: Delete reference to mmap data to avoid warning Re-import externals/netcdf.py from scipy DOCTEST: Avoid fixed ID in doctest DOCTEST: Delete reference to mmap data to avoid warning CI: Test builds on Python 3.8 CI: Python 3.8 not yet available on Azure CI: Wait on upstream releases for full 3.8 tests MNT: Update supported language classifiers DOC: More comprehensive agg_data examples CI: Restore Python 3.8 Azure tests NF: Enable data scaling within the target dtype RF: Implement AFNIArrayProxy._get_scaled(), replacing other overrides ENH: Add get_scaled to Minc, Ecat RF: Rework PARRECArrayProxy TEST: Revise equality check to approximate CI: Enable most dependencies for Python 3.8 CI: Test with matplotlib~=3.2.0rc1 TEST: Validate get_scaled with several float types FIX: Better type promotion TEST: Use np.sctypes to detect available floats RF: Uniformize AFNI/PARREC scaling RF: Use consistent logic for ECAT, Minc1 and PARREC proxies TEST: Verify get_scaled works sensibly with ints MNT: Update nitest-dicom pin TEST: Basic tests for CT DICOM image RF: Avoid unneeded reference DOC: Update docstrings, comments, for clarity MNT: Update mailmap MNT: Update Zenodo DOC: Update changelog MNT: Improve version determination on branches with digits DOC: Update author list MNT: Version 3.0.0rc1 MNT: Version 3.0.0rc1.post.dev MNT: Add gitpython and twine to "dev" extra MNT: Fix Dorota Jarecka ORCID MNT: Drop test data from MANIFEST.in DOC: Discuss slicer interface CI: Update release wheel repository CI: Re-add h5py to Py38 tests CI: Restore old wheel repository TEST: Check non-integral slopes, intercepts CI: Disable pytest for now TEST: Test supported dtypes for Analyze/NIfTI/MGH TEST: Refine parameter and assertion precision FIX: Cast scaling parameters only when safe TEST: Add comment to explain parameters FIX: Accept dtype parameter to ArrayProxy.__array__ TEST: Validate dataobj.__array__(dtype) RF: Drop (mostly) redundant ArrayProxy.get_scaled() method DOC: Update changelog TEST: Filter complex warnings TEST: Improve test naming for tracking down failures FIX: ECAT data must be coerced after reading DOC: Update reviewers in changelog DOC: Update changelog with recent PRs MNT: Remove support for keep_file_open=="auto" MNT: Remove minc.py DOC: Use nifti1 to demonstrate ModuleProxy instead of the ephemeral minc MNT: Remove checkwarns TEST: Test invalid KEEP_FILE_OPEN_DEFAULT values STY: Remove unused import [skip ci] TEST: Move from mock to unittest.mock MNT/DOC: Add h5py to notes, installation extras DOC: Update changelog REL: 3.0.0rc2 MNT: Version 3.0.0rc2.post.dev REL: 3.0 MNT: Begin development on 3.1 MNT: 3.0.x maintenance branch MNT: 3.0.x maintenance branch FIX: Validate ExpiredDeprecationErrors FIX: Interpret "ver+extra" as post-release, not pre-release TEST: Numpy changed longdouble str representations in 1.18 FIX: Expand version comparison logic TEST: Numpy changed longdouble str representations in 1.18 RF: Improve fallback version check, require PyPA packaging module MNT: All supported numpy have float16 MNT: Update changelog, zenodo, in case of future 2.5.x release MNT: Add Ben Darwin to Zenodo DOC: Update changelog, copyright MNT: Update requirements DOC: Update author list DOC: Add missing entry from 3.0.0 changelog MNT: Update Ben Darwin name/affiliation MNT: 3.0.2-dev NEP29: Bump minimum numpy to 1.13 MNT: Minimum packaging of 14.3 MNT: Separate out pytest and nose jobs TEST: Fix tests broken in the rebase CI: Add CHECK_TYPE to Azure CI: Default to nose for Windows for now RF: Avoid running data script code on doctest TEST: Doctests not ready CI: Try alternative CHECK_TYPE test PIN: Avoid pytest 5.3.4 (pytest-dev/pytest#6517) TEST: Add BaseTestCase class to skip TestCases starting with ``_`` TMP: Skip failing streamlines modules CI: Skip converted tests in nose TEST: Fix import/indentation errors ENH: Use generic unittest.SkipTest in missing optional_package TEST: Cleanup test_array_sequence CI: Skip more nose tests TEST: Un-skip tractogram tests, style cleanups TEST: Fix optpkg test TEST: Style updates to test_analyze CI: Give up trying to deselect streamlines TEST: Style cleanup TEST: Simplify data/environment fixtures TEST: Simplify, reformat test_data STY: Remove unused pkgutil import TEST: Refactor NetCDF tests to be more pytest friendly CI: Resolve Travis warnings, remove redundant job TEST: Use skipif mark instead of TestMinc2API.__init__ TEST: Use standard syntax when possible TEST: Use relative imports in gifti tests TEST: Simplify giftiio deprecation tests TEST: Combine imports MNT: Mark incompatible with Python 3.9 TEST: Skip giftiio tests in nose MNT: CI YAML formatting, extraneous .coveragerc TEST: Style and formatting CI: Restore import-only test CI: Enable doctests TEST: Use numpy 1.13 legacy print settings TEST: Convert nibabel.nicom to unittest/pytest TEST: Use vanilla unittest.skip* over pytest RF: Remove unused pieces of testing_pytest and switch to unittest skip CI: Only ignore files that use fixtures TEST: De-indent tests, cleanup style TEST/STY: Cleaner line breaks and alignment for test_fileslice TEST/STY: Alignment in fileutils, floating tests TEST/RF: Reduce redundancy in test_removalschedule, test failure case MNT/FIX: Bump minimum matplotlib to 1.5.2 to match available wheels MNT: Use version 1.5.3 to smooth transition to 3.6 TEST: Remove last imports of nose MNT: Purge nose from requirements, CI RF: Remove nose test state code RF: Reimplement nibabel.test() and nibabel.bench() DOC: Replace nose with pytest in the docs DOC: Update benchmark docstrings TEST: Final few assert_raises CI: Add OSX test to Travis CI: Fix wheel build... weird pip behavior while in source directory FIX: Return pytest.main results from nibabel.test/bench TEST: Might as well test the testers. Found a bug. CI: Install test requirements through extra dependencies DOC: Specify current benchmark file TEST: Style and parameterization fixes for readability TEST: Bad test syntax TEST/RF: Mock compress_ext_map, instead of fixture TEST: Rename tests to ensure running TEST/RF: Reparametrize tests CI: Fail test if docs do not build PY3: Drop Python 2 guards, use runpy instead of exec DOC: Attempt to find versioneer version when building docs DOC: Skip py3k DOC: Fix "``s" pattern in changelog DOC: Address warnings and improve formatting MNT: Update changelog, author list and Zenodo MNT: Drop pyproject.toml for now DOC: Note pyproject.toml removal in changelog MNT: 3.0.3dev NEP29+1y: Drop Python 3.5 CI: Drop 3.5 tests, set min to 3.6, pre-release to 3.8 MNT: Drop deprecated ndarray.tostring for tobytes TEST: Fix warning filter to only check for nibabel-generated warnings MNT: Pin sphinx <3 MNT: Mark incompatible with numpy 1.19, Sphinx 3 MNT: Set maximum numpy to 1.16.x, update requirements.txt CI: Avoid installing too new of numpy/scipy REL: 2.5.2 MNT: 2.5.3-dev NF: Add nibabel.affines.rescale_affine function RF: Update conformation to reorient, rescale and resample MNT: Update mailmap DOC: Update minimum Python DOC: Update author list DOC: Update changelog MNT: Update Zenodo snippet MNT: 3.1.1-dev MNT: 3.2.0-dev MNT: Add affiliation/ORCID for Roberto CI: Require pip <19.2 for Python 3.4 in Travis STY: Satisfy recent flake8 CI: Fix Azure pipelines config CI: Add ARM64 build CI: Drop ARM64 build dependencies to numpy for speed CI: Use scipy-wheels-nightly index on anaconda.org FIX: Ensure nan is cast to currently tested dtype Update nibabel/orientations.py Update nibabel/tests/test_quaternions.py MAINT: Set minimum numpy to 1.14 TEST: Drop numpy 1.13 doctest compatibility TEST: Update doctests to use new numpy print format REL: 3.1.1 MNT: 3.1.2dev RF: Set NIfTI-2 header shape through API call DOC: Add the spec text to explain the dim discrepancy FIX: Save TR in seconds in parrec2nii TEST: Verify that header conversion preserves units ENH: Add bytestring serialization to CIFTI-2 TEST: Add SerializeMixin to TestCifti2ImageAPI MNT: Officially deprecate onetime.setattr_on_read DOC: Update link to descriptor guide TEST: Suppress expected warnings FIX: Avoid/suppress expected warnings FIX: Bad deprecate_with_version calls PY36: Backport nullcontext DOCTEST: Suppress deprecation warnings in doctests of deprecated methods TEST: Suppress warnings in freesurfer MNT: Add pytest-doctestplus to ignore warnings in doctests TEST: Suppress and check warnings in streamlines TEST: Use get_fdata, check for expected warning RF: Drop calls to deprecated get_affine() FIX: Escape backslashes before parsing strings MNT: Reset deprecation clock FIX: Remove doubled-up fix for divide-by-zero warning TEST: Small cleanups FIX: Construct sliceobj from object array; addresses numpy deprecation warning TEST: Use skipIf rather than warn + return for test_multiload TEST: Check import-time warnings on modules via conftest TEST: Use matches or comments to make clear expected warnings TEST: Unused imports TEST: Simplify lazy_load conditional warning check Update nibabel/streamlines/tests/test_tck.py ENH: Add nib-roi command to crop (maybe flip) axes ENH: Cover edge cases like non-scaling images, bad slices TEST: Test nib-roi and helpers FIX: Syntax errors/warnings Update nibabel/cmdline/tests/test_roi.py TEST: Check MINC-2, Analyze, and main() TEST: Use MGHImage to avoid scipy dependency FIX: Improved test for scaling MNT: Update mailmap DOC: Note new minimum Numpy MNT: Update author list, zenodo ordering DOC: Changelog MNT: 3.2.1-dev Trigger builds on maint/ branches and PRs DOC: Update Julian Klug's Zenodo fragment CI: Test on Python 3.9 with numpy nightly wheels PY39: Changed mmap repr PY39: Changes in ast parsing of indices CI: Bump ARM64 tests with compatible packages CI: Drop defunct rackspace wheelhouse CI: More dependencies under 3.9 DOCTEST: Fix np.float uses in the doctests DOC: 3.2.1 changelog MNT: List Python 3.9 in supported versions FIX: Drop keep_file_open=auto from benchmark Christopher P. Cheng (95): TODO1 attempt 1: processed data type, data shape, and data offset of two different headers tweaked to remove AnalyzeHeader but currently still has problems added nib-diff to setup.py first attempt at nib-diff that doesnt work removed incorrectly committed changes first attempt at diff_dicts method and diff testing file tried something else with header fields latest attempt: restructured diff_dicts() method, troubleshooting ensuing errors corrected misplacement of cmdline files and latest attempt at diff_dicts method progress! tweaked bugs, corrected rookie mistakes like cmdline placement, implemented yarik suggestions got rid of proc file and function works at a basic level tweaked diff_dicts to be compatible with tests got rid of None, troubleshot tests introduced hypothesis to use for testing with pretty sexy results noted hypothesis need for tests, refactored diff_dicts name attempt at TODO#2: allowing specification of header fields now functional for several header files. tweak to make hypothesis work with a list, but problem above has not been addressed tweaked names and code as suggested! bug fix cosmetic tweaks cleaned up code promoted generic programming and got test to work again tried to clean code but couldnt get comprehension going comment and docstring added options for text, json, yaml but still have to implement work in progress with all outputs moved nib-ls to make generic use of its functions possible for a comparison function in progress fixed import from utils to ls started on a test_utils module. Not the final tests, just some random strings changes as recommended, thanks Matthew! added test for ap() and made changes re Travis CI fixed ap test problem but TypeError from nose popped up format is out of line but problem is fixed simplified code but now bizarrely doesnt run with two files apparently the variable l is a really big chafe beautified text output, next up json and yaml modified the tests for the new diff_values commenting out json and yaml, cosmetic mod to ls.py made changes as requested moving more cmdline things to the cmdline folder progress towards table formatting table now works and looks p good slight tweak to table formatting very inefficient but successfully removed dtype when its identical removed extra blank line lol boosting coverage refactoring added dicomfs file parrec2nii added data comparison function added reformatted per Travis CI implemented test-nib-diff added another test changed travis appveyor utils per test errors test files wasnt included in last commit by accident maybe this will work instead maybe this will work instead test fixed fixed to be more generic fixed file name issue in nib diff fixed changes as yarik requested fixed problems noted by Travis CI building in difflib to see whats going on latest attempt at compliance changes dict to list combined into one line new structure, names, tests hypothesis: all my problems were due to that one test whoops missed this i think im going to cry. code cleaned and made more pythonic added and fixed tests fixing up appveyor and travis problems fixed a fringe use case style tweak for travis removed duplication, made things more generic moved functionality outside to test and increase coverage boosting coverage by testing main main test corrected for max coverage imported StringIO from six instead of io added a test for cmdline function changes per Yariks comments! changed as commented out in the pull request RF: anticipated files of different shapes, fixed table display, corrected tests elaborated docstring, modified get_data_diff to allow direct array input, added tests for coverage added to diff documentation, undid executable change, took out debugging script in test_scripts undid permission snafu on test_scripts docstring and function name clarification, change get_data to get_fdata() corrected styles per Travis, limited fdata to float32 prepared for future PR to allow modification of dtype used in diff comparison added cmdline functionality for modifying datatype used for file data comparisons added testing for dtype at cmdline, assuming cmdline functionality. changed value output in data_diff function to allow for validation of data type storing changes for main testing added tests to fix coverage problem cmdline test added for dtype access Cindee Madison (27): NF - initial import of ecat functionality NF added correct frame mapping to mlist class update EcatImage to work with new nibabel changes NF clean up for Ecat class NF warning if affines do not match across frames NF further cleanup of code, references to mlist cleaned up NF fix warning in fileobj seek NF adding ecat tests, fix endian typo NF more tests fix issue in endian in tinypet.v NF more tests fix issue in endian in tinypet.v NF tests for EcatSubHeader NF tests for EcatImage NF: added full datatypes, filetypes descriptions , documentation NF: endian issue with tinypet.v NF: added access to mlist and subheader from img, and exceptions for saving NF: added simple examples BF - fixed doctests in ecat BF fix doctest for ecat RF - removed parametric tests from test_ecat BF - fix endian test fail on BE machines fix bug in identifying correct frame number order in a multi-frame ecat file using mlist addd test to find misorder in mlist added test for poorly formed mlist order fix typo in get_frame_affine clarified mlist.get_framenumbers based on comments from MB, added new mlist function get_series_framenumbers to give series frame numbers for data given in file added examples to new function get_series_framenumbers BF+TST catch mismatched hdr, mlist and added more tests Demian Wassermann (58): BF: Fix file trackvis file read when there are scalars and the point mode is rasmm TST: test scalars work with rasmm trackvis option Fix Cifti2TransformationMatrixVoxelIndicesIJKtoXYZ to_xml method Changed the cifti2.py assertions for exceptions Changed the parse_cifti2_fast.py assertions for exceptions Fixed MetaData and its testing Exporting the CIFTIHeaderException to the cifti2 namespace Improved verification/compatibility of the label object with the standard. Increased testing coverage All elements below MatrixIndicesMap fixed and tested Newline homogeneization Fixed header information Cleaned the metaclass helpers Fixed docstring Fixed style and function of MetaData MetaData now behaves like a mapping Interface of LabelTable closer to that of Sequence Better agreement between the Label element and its specification Several docstring fixes as well as removed the squeeze Code cleaned Code cleanup Fixed docstring Removed comments Added submodule for CIFTI2 testing Added test data as submodule Added more I/O tests fixed load/save functions: CIFTI2: MetaData and LabelTable now behave like MutableMapping CIFTI2: MatrixIndicesMap has a MutableSequence behavior Simplified testing by assuming that the parsed header is correct CIFTI2 Improved MatrixIndecesMap interface CIFTI2 Cleanup CIFTI2 simplifications in implementation and testing due to the new interfaces Compatibility with new/future nifti interface Fix testing dependency on lxml VertexIndices and VoxelIndicesIJK now have a MutableSequence interface Improved testing coverage Better handling of volumes in the MatrixIndicesMap Deleted intent_code restriction Removed lxml dependency Increased testing coverage and removed residual methods Clarified code in _Cifti2AsNiftiImage __init__ Changed Cifti2Vertices such that it behaves like a sequence. Added corresponding tests Icreased testing coverage. Cleaned up code Corrected problem in new nifti header checks Increased testing coverage and code cleanup Fixed python 2.7 incompatibility in tests Removed commented code Remove affine attribute from CIFTI2 image __init__ CIFTI2 reading now is performed without loaading all file from disk MetaData can be built from a mapping Improved docstring of Cifti2BrainModel Improved docstring of Cifti2MatrixIndicesMap Code clean Code clean Renamed parse_cifti2_fast to parse_cifti2 Renamed CIFTI2HeaderError to Cifti2HeaderError Unified the CIFTI2 spelling in the documentation Fixed documentation typo Added convenience functions Dimitri Papadopoulos Orfanos (1): Better handle pathological filenames Dorota Jarecka (104): moving test_affines to pytest adding pytest to ravis adding pytest to the windows env testing windows installations trying a different pytest command for windows yet another command for windows fixing path to the test revert some of the changes to the test (didnt notice numpy.testing was already used) adding testing_pytest that removed nose (it will be used temp. for tests converted to pytest) converting tests with tests/test_a*.py and test_wrapstruct (for some reason cant run the tests in one pytest command, so added an extra line to travis for now converting test_b* and test_c* updating travis adding converted test_d* converting more tests to pytest fixing interaction between fixtures moving test_helpers to testing/helpers.py (it contains no tests, but helping functions) adding new tests to travis adding more tests converting more tests converting more tests to pytest converting test to pytest, TODO: some tests are failing on osx adding pytestmark to test that has not been changed to pytest fixing test_wrapstruct: removing setUpClass and adding self.header_class check to all of the test methods: couldnt find better way for suppressing tests from abstract classes and allowing for testing from all child classes changing travis command after fixes in test_wrapstruct converting more tests from nibabel.tests converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* converting more tests nibabel.tests.test_t* converting test_volumeutils converting nibabel_data removing todos Apply suggestions from code review Apply suggestions from code review converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews ignoring tests with pytest.mark.parametrize converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* removing todos Apply suggestions from code review converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews applying suggestions from 865 converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* removing todos converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* removing todos converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* converting nibabel_data removing todos converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* removing todos converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* removing todos converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews converting nibabel/tests/test_scripts.py adding todo converting more tests nibabel.tests.test_s* removing todos converting nibabel/tests/test_scripts.py adding todo removing todos small edits: suggestions from reviews ignoring tests that use needs_nibabel_data some cleaning after using nose2pytest small cleaning after review small edit Update nibabel/tests/test_image_api.py changing testing_pytest back to testing Egor Panfilov (3): Fixed typo in coordinate_systems doc page Fixed typo in coordinate_systems doc page Fixed A-P to P-A in coord systems docs Eleftherios Garyfallidis (3): NF: Tractogram is now more specific and supports multiple keys for scalars and properties which are now called data_per_steamlines and data_per_points respectively Updated TractogramFile minor cleanup Eric Larson (64): ENH: Adding vox2ras_tkr FIX(?): Add zooms test FIX: Deal with borked test dataset FIX: Match MRIRead.m FIX?: Order FIX: Reverting to mri_info test compat FIX: Cleaner tests FIX: Minor fixes ENH: Add suppress_warnings FIX: Support XYTZ order and multiple echos in PAR/REC files ENH: Support for partial recordings, and overwrite checking WIP: Add bvals/bvecs FIX: Working for variable scale factors ENH: Add dwell time FIX: Verbose dwell output FIX: Fix dwell time FIX: Fix numpy FIX: Move most work to parrec FIX: Fix for truncated data FIX: Fix tests FIX: Fix openers FIX: Minor fixes to clean up tests in windows FIX: Py3k on Linux fixes STY: PEP8 FIX: Remove trace by default ENH: Add appveyor and improve test ENH: Add an extra windows build FIX: Fix badge ENH: Add crosshairs, modify mode FIX: Minor fixes ENH: Add set_indices method ENH: Allow time dimension ENH: Better tests FIX: Update volume plot FIX: Remove monkey patching WIP WIP: Closer to correcting orientation WIP: Fixed ratio FIX: FIX time plot FIX: Fix orientations and interactions FIX: Minor fixes FIX: Fix test FIX: Better testing STY: Remove dicts in favor of lists FIX: Cleanup on close FIX: Better unlinking FIX: Minor fix FIX: Fix operators FIX: Clean up code FIX: Fix for NumPy deprecation STY: Clearer conditional FIX: Allow tr=0 in mghformat FIX: Better messages BUG: Fix deprecated imports FIX: Escapes and NumPy import BUG: larsoner BUG: Fix escape BUG: More escapes BUG: Fix escape BUG: More escapes BUG: Fix escape character FIX: r BUG: Use manager to set title FIX: NumPy builtin type deprecation Eric M. Baker (7): BF: Remove assumption that StackID is always the first dimension of the frame indices for multiframe DICOM BF: Correct StackID DICOM tags TST: Update test for MultiframeWrapper.image_shape TST: Update dependent tests that were missed previously DOC: Add short explanation and references to image_shape function for the Multi-frame DICOM wrapper RF: Remove use of 'FunctionalGroupPointer' in determining 'StackID' axis DOC: Fix external link rendering Erik Kastman (30): Add Nifti1DicomExtension + test Add @dicom_test decorator to Pass w/o pydicom Use BytesIO (py3k compatibility) Fix BytesIO import (again), py3.3 compat Fix writing typo, add writing tests Zeropad Extension to 16 bytes, test writing A little cleanup Read full datasets (with TransferSyntax) Use write_dataset for pydicom < 0.9.9 compat PEP8 Whitespace Test TransferSyntax, fix zipped reading. Revert "Read Full Datasets Using TransferSyntax" Revert "PEP8 Whitespace" Revert "Use write_dataset for pydicom < 0.9.9 compat" Revert "Read full datasets (with TransferSyntax)" PEP8 + consistency cleanup Create empty dataset or use one if provided Add Doc page on NIfTI header PEP8 and header warning (doc) Import and doc cleanup PEP8 Cleanup NiftiHeader determines dicom byte encoding in extension DOC Add docstring to DicomExtension __init__ RF Type cleanup from MB’s suggestions BF Import pydicom…
I'm getting internal errors in pytest 5.3.4 on my test suite. Pinning to 5.3.3 fixes. The first few tests run, and then it raises an assertion error with the following traceback:
This is running on Linux on Travis-CI. Relevant information are in folds within Travis logs; links below will highlight the right line so you can find it more easily.
conda list
output in that jobconda list
output in that jobFor your convenience, here's the diff of the two
conda list
outputs (copy-pasted to local files):Here's the diff between the two commits:
I'm afraid that a minimal example might take me a while, (it's 8:30pm and I want to post this before I leave the office) so I'm leaving that stage out. I hope this is still enough for you to work with!
pip list
from the virtual environment you are usingThe text was updated successfully, but these errors were encountered: