@@ -14,6 +14,67 @@ Below is a complete list of all pytest features which are considered deprecated.
14
14
:class: `_pytest.warning_types.PytestWarning ` or subclasses, which can be filtered using
15
15
:ref: `standard warning filters <warnings >`.
16
16
17
+ Internal classes accessed through ``Node ``
18
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19
+
20
+ .. deprecated :: 3.9
21
+
22
+ Access of ``Module ``, ``Function ``, ``Class ``, ``Instance ``, ``File `` and ``Item `` through ``Node `` instances now issue
23
+ this warning::
24
+
25
+ usage of Function.Module is deprecated, please use pytest.Module instead
26
+
27
+ Users should just ``import pytest `` and access those objects using the ``pytest `` module.
28
+
29
+ This has been documented as deprecated for years, but only now we are actually emitting deprecation warnings.
30
+
31
+ ``cached_setup ``
32
+ ~~~~~~~~~~~~~~~~
33
+
34
+ .. deprecated :: 3.9
35
+
36
+ ``request.cached_setup `` was the precursor of the setup/teardown mechanism available to fixtures.
37
+
38
+ Example:
39
+
40
+ .. code-block :: python
41
+
42
+ @pytest.fixture
43
+ def db_session ():
44
+ return request.cached_setup(
45
+ setup = Session.create, teardown = lambda session : session.close(), scope = " module"
46
+ )
47
+
48
+ This should be updated to make use of standard fixture mechanisms:
49
+
50
+ .. code-block :: python
51
+
52
+ @pytest.fixture (scope = " module" )
53
+ def db_session ():
54
+ session = Session.create()
55
+ yield session
56
+ session.close()
57
+
58
+
59
+ You can consult `funcarg comparision section in the docs <https://docs.pytest.org/en/latest/funcarg_compare.html >`_ for
60
+ more information.
61
+
62
+ This has been documented as deprecated for years, but only now we are actually emitting deprecation warnings.
63
+
64
+
65
+ Using ``Class `` in custom Collectors
66
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
+
68
+ .. deprecated :: 3.9
69
+
70
+ Using objects named ``"Class" `` as a way to customize the type of nodes that are collected in ``Collector ``
71
+ subclasses has been deprecated. Users instead should use ``pytest_collect_make_item `` to customize node types during
72
+ collection.
73
+
74
+ This issue should affect only advanced plugins who create new collection types, so if you see this warning
75
+ message please contact the authors so they can change the code.
76
+
77
+
17
78
``Config.warn `` and ``Node.warn ``
18
79
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19
80
0 commit comments