diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 415bfd7c780..ef5528f69c6 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -82,7 +82,7 @@ Breaking Changes the test suite. -- `#7122 `_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's ``eval()``. +- `#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. @@ -113,7 +113,7 @@ Breaking Changes - `#7226 `_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. -- `#7418 `_: Remove the `pytest_doctest_prepare_content` hook specification. This hook +- `#7418 `_: Removed the `pytest_doctest_prepare_content` hook specification. This hook hasn't been triggered by pytest for at least 10 years. @@ -134,17 +134,6 @@ Breaking Changes Deprecations ------------ -- `#6981 `_: Deprecate the ``pytest.collect`` module as it's just aliases into ``pytest``. - - -- `#7097 `_: The ``pytest._fillfuncargs`` function is now deprecated. This function was kept - for backward compatibility with an older plugin. - - It's functionality is not meant to be used directly, but if you must replace - it, use `function._request._fillfixtures()` instead, though note this is not - a public API and may break in the future. - - - `#7210 `_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. @@ -152,7 +141,6 @@ Deprecations if you use this and want a replacement. - Features -------- @@ -192,22 +180,6 @@ Features This hook is meant to replace `pytest_warning_captured`, which will be removed in a future release. -- `#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 `_: 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``. - - - `#6471 `_: New command-line flags: * `--no-header`: disables the initial header, including platform, version, and plugins. @@ -238,17 +210,13 @@ Features You can read more about this option in `the documentation `__. -- `#7305 `_: New ``required_plugins`` configuration option allows the user to specify a list of plugins required for pytest to run. An error is raised if any required plugins are not found when running pytest. - - -- `#7346 `_: Version information as defined by `PEP 440 `_ may now be included when providing plugins to the ``required_plugins`` configuration option. - +- `#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 `_: The ``pytest`` command now supresses the ``BrokenPipeError`` error message that +- `#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``). @@ -259,11 +227,27 @@ Improvements - `#4675 `_: Rich comparison for dataclasses and `attrs`-classes is now recursive. +- `#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 `_: 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 `_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. -- `#6940 `_: When using the ``--duration`` option, the terminal message output is now more precise about the number and durations of hidden items. +- `#6940 `_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. - `#6991 `_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. @@ -275,22 +259,18 @@ Improvements file descriptors would fail or be lost in this case. -- `#7119 `_: Exit with an error if the ``--basetemp`` argument is empty, the current working directory or parent directory of it. +- `#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 `_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. - +- `#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 `_: ``caplog.set_level()`` will now override any :confval:`log_level` set via the CLI or ``.ini``. +- `#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 `_: When the ``caplog`` fixture is used to change the log level for capturing, - using ``caplog.set_level()`` or ``caplog.at_level()``, it no longer affects - the level of logs that are shown in the "Captured log report" report section. - -- `#7264 `_: The dependency on the ``wcwidth`` package has been removed. +- `#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 `_: Improve recursive diff report for comparison asserts on dataclasses / attrs. @@ -315,17 +295,17 @@ Improvements Bug Fixes --------- -- `#1120 `_: Fix issue where directories from tmpdir are not removed properly when multiple instances of pytest are running in parallel. +- `#1120 `_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. -- `#4583 `_: Prevent crashing and provide a user-friendly error when a marker expression (-m) invoking of eval() raises any exception. +- `#4583 `_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. - `#4677 `_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. - `#5456 `_: Fix a possible race condition when trying to remove lock files used to control access to folders - created by ``tmp_path`` and ``tmpdir``. + created by :fixture:`tmp_path` and :fixture:`tmpdir`. - `#6240 `_: Fixes an issue where logging during collection step caused duplication of log @@ -336,10 +316,10 @@ Bug Fixes changed since the start of the session. -- `#6755 `_: Support deleting paths longer than 260 characters on windows created inside tmpdir. +- `#6755 `_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. -- `#6871 `_: Fix crash with captured output when using the :fixture:`capsysbinary fixture `. +- `#6871 `_: Fix crash with captured output when using :fixture:`capsysbinary`. - `#6909 `_: Revert the change introduced by `#6330 `_, which required all arguments to ``@pytest.mark.parametrize`` to be explicitly defined in the function signature. @@ -353,22 +333,22 @@ Bug Fixes - `#6924 `_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. -- `#6925 `_: Fix TerminalRepr instances to be hashable again. +- `#6925 `_: Fix `TerminalRepr` instances to be hashable again. -- `#6947 `_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. +- `#6947 `_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. - `#6951 `_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. -- `#6956 `_: Prevent pytest from printing ConftestImportFailure traceback to stdout. +- `#6956 `_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. - `#6991 `_: Fix regressions with `--lf` filtering too much since pytest 5.4. -- `#6992 `_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. +- `#6992 `_: Revert "tmpdir: clean up indirection via config for factories" `#6767 `_ as it breaks pytest-xdist. - `#7061 `_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. @@ -384,7 +364,7 @@ Bug Fixes parameter when Python is called with the ``-bb`` flag. -- `#7143 `_: Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor. +- `#7143 `_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. - `#7145 `_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. @@ -396,8 +376,7 @@ Bug Fixes - `#7180 `_: Fix ``_is_setup_py`` for files encoded differently than locale. -- `#7215 `_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` - subclasses for skipped tests. +- `#7215 `_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. - `#7253 `_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, @@ -416,13 +395,13 @@ Bug Fixes Improved Documentation ---------------------- -- `#7202 `_: The development guide now links to the contributing section of the docs and 'RELEASING.rst' on GitHub. +- `#7202 `_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. - `#7233 `_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. -- `#7345 `_: Explain indirect parametrization and markers for fixtures +- `#7345 `_: Explain indirect parametrization and markers for fixtures. @@ -433,16 +412,19 @@ Trivial/Internal Changes provided explicitly, and is always set. +- `#7264 `_: The dependency on the ``wcwidth`` package has been removed. + + - `#7291 `_: Replaced ``py.iniconfig`` with `iniconfig `__. - `#7295 `_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. -- `#7356 `_: Remove last internal uses of deprecated "slave" term from old pytest-xdist. +- `#7356 `_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. -- `#7357 `_: py>=1.8.2 is now required. +- `#7357 `_: ``py``>=1.8.2 is now required. pytest 5.4.3 (2020-06-02)