Skip to content

Commit f9afcd2

Browse files
authoredNov 10, 2021
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
1 parent d6e6b96 commit f9afcd2

14 files changed

+50
-20
lines changed
 

‎changelog/451.doc.rst

-1
This file was deleted.

‎changelog/7259.breaking.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Since `py.path.local` is a `os.PathLike[str]`, these plugins are unaffacted.
55

66
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)`.
77
Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead.
8+
89
Note: pytest was not able to provide a deprecation period for this change.

‎changelog/7864.improvement.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Improved error messages when parsing warning filters.
22

3-
Previously pytest would show an internal traceback, which besides ugly sometimes would hide the cause
3+
Previously pytest would show an internal traceback, which besides being ugly sometimes would hide the cause
44
of the problem (for example an ``ImportError`` while importing a specific warning type).

‎changelog/8061.bugfix.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fixed failing staticmethod test cases if they are inherited from a parent test class.
1+
Fixed failing ``staticmethod`` test cases if they are inherited from a parent test class.

‎changelog/8133.trivial.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Migrate to setuptools_scm 6.x to use SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST for more robust release tooling.
1+
Migrate to ``setuptools_scm`` 6.x to use ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST`` for more robust release tooling.

‎changelog/8251.deprecation.rst

-1
This file was deleted.

‎changelog/8447.deprecation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Defining a custom pytest node type which is both an :class:`pytest.Item <Item>` and a :class:`pytest.Collector <Collector>` now issues a warning.
1+
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.
22
It was never sanely supported and triggers hard to debug errors.
33

4-
Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example.
4+
See :ref:`the deprecation note <diamond-inheritance-deprecated>` for full details.

‎changelog/8592.deprecation.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
: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.
2+
3+
See :ref:`the deprecation note <cmdline-preparse-deprecated>` for full details.

‎changelog/8803.improvement.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
It is now possible to add colors to custom log levels on cli log.
22

3-
By using :func:`add_color_level <_pytest.logging.add_color_level` from a ``pytest_configure`` hook, colors can be added::
3+
By using :func:`add_color_level <_pytest.logging.add_color_level>` from a ``pytest_configure`` hook, colors can be added::
44

55
logging_plugin = config.pluginmanager.get_plugin('logging-plugin')
66
logging_plugin.log_cli_handler.formatter.add_color_level(logging.INFO, 'cyan')
77
logging_plugin.log_cli_handler.formatter.add_color_level(logging.SPAM, 'blue')
88

9-
See :ref:`log_colors` for more information.
9+
See :ref:`log_colors` for more information.

‎changelog/8897.doc.rst

Whitespace-only changes.

‎changelog/8994.improvement.rst

-2
This file was deleted.
File renamed without changes.

‎changelog/9242.doc.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +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.
1+
Upgrade readthedocs configuration to use a `newer Ubuntu version <https://blog.readthedocs.com/new-build-specification/>`__` with better unicode support for PDF docs.

‎doc/en/deprecations.rst

+39-8
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the
5555

5656
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.
5757

58+
Directly constructing internal classes
59+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60+
61+
.. deprecated:: 7.0
62+
63+
Directly constructing the following classes is now deprecated:
64+
65+
- ``_pytest.mark.structures.Mark``
66+
- ``_pytest.mark.structures.MarkDecorator``
67+
- ``_pytest.mark.structures.MarkGenerator``
68+
- ``_pytest.python.Metafunc``
69+
- ``_pytest.runner.CallInfo``
70+
- ``_pytest._code.ExceptionInfo``
71+
- ``_pytest.config.argparsing.Parser``
72+
- ``_pytest.config.argparsing.OptionGroup``
73+
- ``_pytest.pytester.HookRecorder``
74+
75+
These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8.
76+
77+
.. _cmdline-preparse-deprecated:
5878

5979
Passing ``msg=`` to ``pytest.skip``, ``pytest.fail`` or ``pytest.exit``
6080
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -110,18 +130,19 @@ Implement the :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load
110130
) -> None:
111131
...
112132
133+
.. _diamond-inheritance-deprecated:
113134

114-
Diamond inheritance between :class:`pytest.File` and :class:`pytest.Item`
115-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135+
Diamond inheritance between :class:`pytest.Collector` and :class:`pytest.Item`
136+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116137

117138
.. deprecated:: 7.0
118139

119-
Inheriting from both Item and file at once has never been supported officially,
120-
however some plugins providing linting/code analysis have been using this as a hack.
121-
122-
This practice is now officially deprecated and a common way to fix this is `example pr fixing inheritance`_.
123-
140+
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.
141+
It was never sanely supported and triggers hard to debug errors.
124142

143+
Some plugins providing linting/code analysis have been using this as a hack.
144+
Instead, a separate collector node should be used, which collects the item. See
145+
:ref:`non-python tests` for an example, as well as an `example pr fixing inheritance`_.
125146

126147
.. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files
127148

@@ -132,7 +153,7 @@ Backward compatibilities in ``Parser.addoption``
132153
.. deprecated:: 2.4
133154

134155
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
135-
scheduled for removal in pytest 7 (deprecated since pytest 2.4.0):
156+
scheduled for removal in pytest 8 (deprecated since pytest 2.4.0):
136157

137158
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
138159
- ``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
151172
:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` /
152173
:func:`unittest.skip` in unittest test cases is fully supported.
153174

175+
Using ``pytest.warns(None)``
176+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177+
178+
.. deprecated:: 7.0
179+
180+
:func:`pytest.warns(None) <pytest.warns>` is now deprecated because many people used
181+
it to mean "this code does not emit warnings", but it actually had the effect of
182+
checking that the code emits at least one warning of any type - like ``pytest.warns()``
183+
or ``pytest.warns(Warning)``.
184+
154185

155186
The ``--strict`` command-line option
156187
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)
Please sign in to comment.