From b39b69a7309e06c3ddee4bf74bdfecfdafd2dc16 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 20 Dec 2018 09:31:24 -0200 Subject: [PATCH 1/2] Use sphinx-removed-in extension in the documentation Fix #4568 --- doc/en/conf.py | 3 ++- doc/en/deprecations.rst | 38 +++++++++++++++++++------------------- doc/en/requirements.txt | 1 + 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/doc/en/conf.py b/doc/en/conf.py index 445449185..75a84c5cb 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -42,10 +42,11 @@ todo_include_todos = 1 extensions = [ "pygments_pytest", "sphinx.ext.autodoc", - "sphinx.ext.todo", "sphinx.ext.autosummary", "sphinx.ext.intersphinx", + "sphinx.ext.todo", "sphinx.ext.viewcode", + "sphinx_removed_in", "sphinxcontrib_trio", ] diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index f3240cec7..3e5c897b9 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -101,7 +101,7 @@ an appropriate period of deprecation has passed. Using ``Class`` in custom Collectors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 Using objects named ``"Class"`` as a way to customize the type of nodes that are collected in ``Collector`` subclasses has been deprecated. Users instead should use ``pytest_pycollect_makeitem`` to customize node types during @@ -114,7 +114,7 @@ message please contact the authors so they can change the code. marks in ``pytest.mark.parametrize`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 Applying marks to values of a ``pytest.mark.parametrize`` call is now deprecated. For example: @@ -162,7 +162,7 @@ To update the code, use ``pytest.param``: ``pytest_funcarg__`` prefix ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 In very early pytest versions fixtures could be defined using the ``pytest_funcarg__`` prefix: @@ -184,7 +184,7 @@ Switch over to the ``@pytest.fixture`` decorator: [pytest] section in setup.cfg files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 ``[pytest]`` sections in ``setup.cfg`` files should now be named ``[tool:pytest]`` to avoid conflicts with other distutils commands. @@ -193,7 +193,7 @@ to avoid conflicts with other distutils commands. Metafunc.addcall ~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 :meth:`_pytest.python.Metafunc.addcall` was a precursor to the current parametrized mechanism. Users should use :meth:`_pytest.python.Metafunc.parametrize` instead. @@ -217,7 +217,7 @@ Becomes: ``cached_setup`` ~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 ``request.cached_setup`` was the precursor of the setup/teardown mechanism available to fixtures. @@ -249,7 +249,7 @@ more information. pytest_plugins in non-top-level conftest files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 Defining ``pytest_plugins`` is now deprecated in non-top-level conftest.py files because they will activate referenced plugins *globally*, which is surprising because for all other pytest @@ -259,7 +259,7 @@ features ``conftest.py`` files are only *active* for tests at or below it. ``Config.warn`` and ``Node.warn`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 Those methods were part of the internal pytest warnings system, but since ``3.8`` pytest is using the builtin warning system for its own warnings, so those two functions are now deprecated. @@ -286,7 +286,7 @@ Becomes: record_xml_property ~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 The ``record_xml_property`` fixture is now deprecated in favor of the more generic ``record_property``, which can be used by other consumers (for example ``pytest-html``) to obtain custom information about the test run. @@ -309,7 +309,7 @@ Change to: Passing command-line string to ``pytest.main()`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 Passing a command-line string to ``pytest.main()`` is deprecated: @@ -331,7 +331,7 @@ on (for example ``bash`` or ``Powershell``), but this is very hard/impossible to Calling fixtures directly ~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 Calling a fixture function directly, as opposed to request them in a test function, is deprecated. @@ -384,7 +384,7 @@ with the ``name`` parameter: ``yield`` tests ~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 pytest supported ``yield``-style tests, where a test function actually ``yield`` functions and values that are then turned into proper test methods. Example: @@ -412,7 +412,7 @@ This form of test function doesn't support fixtures properly, and users should s Internal classes accessed through ``Node`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 Access of ``Module``, ``Function``, ``Class``, ``Instance``, ``File`` and ``Item`` through ``Node`` instances now issue this warning:: @@ -426,7 +426,7 @@ This has been documented as deprecated for years, but only now we are actually e ``pytest_namespace`` ~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0.* +.. versionremoved:: 4.0 This hook is deprecated because it greatly complicates the pytest internals regarding configuration and initialization, making some bug fixes and refactorings impossible. @@ -461,7 +461,7 @@ As a stopgap measure, plugin authors may still inject their names into pytest's Reinterpretation mode (``--assert=reinterp``) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 3.0.* +.. versionremoved:: 3.0 Reinterpretation mode has now been removed and only plain and rewrite mode are available, consequently the ``--assert=reinterp`` option is @@ -473,7 +473,7 @@ explicitly turn on assertion rewriting for those files. Removed command-line options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 3.0.* +.. versionremoved:: 3.0 The following deprecated commandline options were removed: @@ -485,7 +485,7 @@ The following deprecated commandline options were removed: py.test-X* entry points ~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 3.0.* +.. versionremoved:: 3.0 Removed all ``py.test-X*`` entry points. The versioned, suffixed entry points were never documented and a leftover from a pre-virtualenv era. These entry @@ -496,7 +496,7 @@ removes a source of confusion for users. ``Node.get_marker`` ~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0* +.. versionremoved:: 4.0 As part of a large :ref:`marker-revamp`, :meth:`_pytest.nodes.Node.get_marker` is deprecated. See :ref:`the documentation ` on tips on how to update your code. @@ -505,7 +505,7 @@ As part of a large :ref:`marker-revamp`, :meth:`_pytest.nodes.Node.get_marker` i ``somefunction.markname`` ~~~~~~~~~~~~~~~~~~~~~~~~~ -*Removed in version 4.0* +.. versionremoved:: 4.0 As part of a large :ref:`marker-revamp` we already deprecated using ``MarkInfo`` the only correct way to get markers of an element is via ``node.iter_markers(name)``. diff --git a/doc/en/requirements.txt b/doc/en/requirements.txt index 80c57422f..4e2b8ce1a 100644 --- a/doc/en/requirements.txt +++ b/doc/en/requirements.txt @@ -1,3 +1,4 @@ pygments-pytest>=1.1.0 sphinx>=1.8.2 sphinxcontrib-trio +sphinx-removed-in>=0.1.3 From 81c2780d2b50a7493da59df7588c9719e8f70894 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 2 Jan 2019 19:37:17 -0200 Subject: [PATCH 2/2] Move Node.get_marker and markname deprecations next to the other 4.0 ones --- doc/en/deprecations.rst | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index 3e5c897b9..ebde15734 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -423,6 +423,24 @@ Users should just ``import pytest`` and access those objects using the ``pytest` This has been documented as deprecated for years, but only now we are actually emitting deprecation warnings. +``Node.get_marker`` +~~~~~~~~~~~~~~~~~~~ + +.. versionremoved:: 4.0 + +As part of a large :ref:`marker-revamp`, :meth:`_pytest.nodes.Node.get_marker` is deprecated. See +:ref:`the documentation ` on tips on how to update your code. + + +``somefunction.markname`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionremoved:: 4.0 + +As part of a large :ref:`marker-revamp` we already deprecated using ``MarkInfo`` +the only correct way to get markers of an element is via ``node.iter_markers(name)``. + + ``pytest_namespace`` ~~~~~~~~~~~~~~~~~~~~ @@ -491,21 +509,3 @@ Removed all ``py.test-X*`` entry points. The versioned, suffixed entry points were never documented and a leftover from a pre-virtualenv era. These entry points also created broken entry points in wheels, so removing them also removes a source of confusion for users. - - -``Node.get_marker`` -~~~~~~~~~~~~~~~~~~~ - -.. versionremoved:: 4.0 - -As part of a large :ref:`marker-revamp`, :meth:`_pytest.nodes.Node.get_marker` is deprecated. See -:ref:`the documentation ` on tips on how to update your code. - - -``somefunction.markname`` -~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionremoved:: 4.0 - -As part of a large :ref:`marker-revamp` we already deprecated using ``MarkInfo`` -the only correct way to get markers of an element is via ``node.iter_markers(name)``.