More pytest 7 changelog fixes (#9285)
* Remove changelog entry for #8251 Reverted in #8903 * Move #9202 changelog to to trivial This won't concern users of pytest * Streamline deprecation changelogs/docs * Remove #8994 changelog This is an impovement for a warning introduced in this release, so including it in a changelog against the last release seems confusing. * Remove #9241 changelog This is an impovement for a doc update introduced in this release, so including it in a changelog against the last release seems confusing. The issue number also seems about something different. * Remove #8897 changelog Empty file... * Various minor changelog fixes
This commit is contained in:
parent
d6e6b9696d
commit
f9afcd2d8a
|
@ -1 +0,0 @@
|
||||||
The PDF documentation’s list of plugins doesn’t run off the page anymore.
|
|
|
@ -5,4 +5,5 @@ Since `py.path.local` is a `os.PathLike[str]`, these plugins are unaffacted.
|
||||||
|
|
||||||
Plugins and users which call `reportinfo()`, use the first return value and interact with it as a `py.path.local`, would need to adjust by calling `py.path.local(fspath)`.
|
Plugins and users which call `reportinfo()`, use the first return value and interact with it as a `py.path.local`, would need to adjust by calling `py.path.local(fspath)`.
|
||||||
Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead.
|
Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead.
|
||||||
|
|
||||||
Note: pytest was not able to provide a deprecation period for this change.
|
Note: pytest was not able to provide a deprecation period for this change.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Improved error messages when parsing warning filters.
|
Improved error messages when parsing warning filters.
|
||||||
|
|
||||||
Previously pytest would show an internal traceback, which besides ugly sometimes would hide the cause
|
Previously pytest would show an internal traceback, which besides being ugly sometimes would hide the cause
|
||||||
of the problem (for example an ``ImportError`` while importing a specific warning type).
|
of the problem (for example an ``ImportError`` while importing a specific warning type).
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Fixed failing staticmethod test cases if they are inherited from a parent test class.
|
Fixed failing ``staticmethod`` test cases if they are inherited from a parent test class.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Migrate to setuptools_scm 6.x to use SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST for more robust release tooling.
|
Migrate to ``setuptools_scm`` 6.x to use ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST`` for more robust release tooling.
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Deprecate ``Node.fspath`` as we plan to move off `py.path.local <https://py.readthedocs.io/en/latest/path.html>`__ and switch to :mod:``pathlib``.
|
|
|
@ -1,4 +1,4 @@
|
||||||
Defining a custom pytest node type which is both an :class:`pytest.Item <Item>` and a :class:`pytest.Collector <Collector>` now issues a warning.
|
Defining a custom pytest node type which is both an :class:`pytest.Item <Item>` and a :class:`pytest.Collector <Collector>` (e.g. :class:`pytest.File <File>`) now issues a warning.
|
||||||
It was never sanely supported and triggers hard to debug errors.
|
It was never sanely supported and triggers hard to debug errors.
|
||||||
|
|
||||||
Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example.
|
See :ref:`the deprecation note <diamond-inheritance-deprecated>` for full details.
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
:func:`pytest_cmdline_preparse <_pytest.hookspec.pytest_cmdline_preparse>` has been officially deprecated. It will be removed in a future release. Use :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load_initial_conftests>` instead.
|
:func:`pytest_cmdline_preparse <_pytest.hookspec.pytest_cmdline_preparse>` has been officially deprecated. It will be removed in a future release. Use :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load_initial_conftests>` instead.
|
||||||
|
|
||||||
|
See :ref:`the deprecation note <cmdline-preparse-deprecated>` for full details.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
It is now possible to add colors to custom log levels on cli log.
|
It is now possible to add colors to custom log levels on cli log.
|
||||||
|
|
||||||
By using :func:`add_color_level <_pytest.logging.add_color_level` from a ``pytest_configure`` hook, colors can be added::
|
By using :func:`add_color_level <_pytest.logging.add_color_level>` from a ``pytest_configure`` hook, colors can be added::
|
||||||
|
|
||||||
logging_plugin = config.pluginmanager.get_plugin('logging-plugin')
|
logging_plugin = config.pluginmanager.get_plugin('logging-plugin')
|
||||||
logging_plugin.log_cli_handler.formatter.add_color_level(logging.INFO, 'cyan')
|
logging_plugin.log_cli_handler.formatter.add_color_level(logging.INFO, 'cyan')
|
||||||
logging_plugin.log_cli_handler.formatter.add_color_level(logging.SPAM, 'blue')
|
logging_plugin.log_cli_handler.formatter.add_color_level(logging.SPAM, 'blue')
|
||||||
|
|
||||||
See :ref:`log_colors` for more information.
|
See :ref:`log_colors` for more information.
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
Included the module of the class in the error message about direct
|
|
||||||
node construction (without using ``from_parent``).
|
|
|
@ -1 +1 @@
|
||||||
Upgrade readthedocs configuration to use a [newer Ubuntu version](https://blog.readthedocs.com/new-build-specification/) with better unicode support for PDF docs.
|
Upgrade readthedocs configuration to use a `newer Ubuntu version <https://blog.readthedocs.com/new-build-specification/>`__` with better unicode support for PDF docs.
|
||||||
|
|
|
@ -55,6 +55,26 @@ In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the
|
||||||
|
|
||||||
The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments.
|
The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments.
|
||||||
|
|
||||||
|
Directly constructing internal classes
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. deprecated:: 7.0
|
||||||
|
|
||||||
|
Directly constructing the following classes is now deprecated:
|
||||||
|
|
||||||
|
- ``_pytest.mark.structures.Mark``
|
||||||
|
- ``_pytest.mark.structures.MarkDecorator``
|
||||||
|
- ``_pytest.mark.structures.MarkGenerator``
|
||||||
|
- ``_pytest.python.Metafunc``
|
||||||
|
- ``_pytest.runner.CallInfo``
|
||||||
|
- ``_pytest._code.ExceptionInfo``
|
||||||
|
- ``_pytest.config.argparsing.Parser``
|
||||||
|
- ``_pytest.config.argparsing.OptionGroup``
|
||||||
|
- ``_pytest.pytester.HookRecorder``
|
||||||
|
|
||||||
|
These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8.
|
||||||
|
|
||||||
|
.. _cmdline-preparse-deprecated:
|
||||||
|
|
||||||
Passing ``msg=`` to ``pytest.skip``, ``pytest.fail`` or ``pytest.exit``
|
Passing ``msg=`` to ``pytest.skip``, ``pytest.fail`` or ``pytest.exit``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -110,18 +130,19 @@ Implement the :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load
|
||||||
) -> None:
|
) -> None:
|
||||||
...
|
...
|
||||||
|
|
||||||
|
.. _diamond-inheritance-deprecated:
|
||||||
|
|
||||||
Diamond inheritance between :class:`pytest.File` and :class:`pytest.Item`
|
Diamond inheritance between :class:`pytest.Collector` and :class:`pytest.Item`
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. deprecated:: 7.0
|
.. deprecated:: 7.0
|
||||||
|
|
||||||
Inheriting from both Item and file at once has never been supported officially,
|
Defining a custom pytest node type which is both an :class:`pytest.Item <Item>` and a :class:`pytest.Collector <Collector>` (e.g. :class:`pytest.File <File>`) now issues a warning.
|
||||||
however some plugins providing linting/code analysis have been using this as a hack.
|
It was never sanely supported and triggers hard to debug errors.
|
||||||
|
|
||||||
This practice is now officially deprecated and a common way to fix this is `example pr fixing inheritance`_.
|
|
||||||
|
|
||||||
|
|
||||||
|
Some plugins providing linting/code analysis have been using this as a hack.
|
||||||
|
Instead, a separate collector node should be used, which collects the item. See
|
||||||
|
:ref:`non-python tests` for an example, as well as an `example pr fixing inheritance`_.
|
||||||
|
|
||||||
.. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files
|
.. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files
|
||||||
|
|
||||||
|
@ -132,7 +153,7 @@ Backward compatibilities in ``Parser.addoption``
|
||||||
.. deprecated:: 2.4
|
.. deprecated:: 2.4
|
||||||
|
|
||||||
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
|
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
|
||||||
scheduled for removal in pytest 7 (deprecated since pytest 2.4.0):
|
scheduled for removal in pytest 8 (deprecated since pytest 2.4.0):
|
||||||
|
|
||||||
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
|
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
|
||||||
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.
|
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.
|
||||||
|
@ -151,6 +172,16 @@ collection. You are probably not doing that. Ordinary usage of
|
||||||
:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` /
|
:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` /
|
||||||
:func:`unittest.skip` in unittest test cases is fully supported.
|
:func:`unittest.skip` in unittest test cases is fully supported.
|
||||||
|
|
||||||
|
Using ``pytest.warns(None)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. deprecated:: 7.0
|
||||||
|
|
||||||
|
:func:`pytest.warns(None) <pytest.warns>` is now deprecated because many people used
|
||||||
|
it to mean "this code does not emit warnings", but it actually had the effect of
|
||||||
|
checking that the code emits at least one warning of any type - like ``pytest.warns()``
|
||||||
|
or ``pytest.warns(Warning)``.
|
||||||
|
|
||||||
|
|
||||||
The ``--strict`` command-line option
|
The ``--strict`` command-line option
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
Loading…
Reference in New Issue