You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the following hooks now receive additional arguments:
113
-
114
-
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
115
-
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
116
-
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
117
-
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
118
-
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
119
-
120
-
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.
121
-
122
-
.. note::
123
-
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
124
-
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
125
-
being ``path``) is **the opposite** of the situation for hooks (the old
126
-
argument being ``path``).
127
-
128
-
This is an unfortunate artifact due to historical reasons, which should be
129
-
resolved in future versions as we slowly get rid of the :pypi:`py`
130
-
dependency (see :issue:`9283` for a longer discussion).
131
-
132
107
Directly constructing internal classes
133
108
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134
109
@@ -276,6 +251,33 @@ an appropriate period of deprecation has passed.
276
251
277
252
Some breaking changes which could not be deprecated are also listed.
278
253
254
+
``py.path.local`` arguments for hooks replaced with ``pathlib.Path``
In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the following hooks now receive additional arguments:
261
+
262
+
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
263
+
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
264
+
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
265
+
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
266
+
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
267
+
268
+
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.
269
+
270
+
.. note::
271
+
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
272
+
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
273
+
being ``path``) is **the opposite** of the situation for hooks (the old
274
+
argument being ``path``).
275
+
276
+
This is an unfortunate artifact due to historical reasons, which should be
277
+
resolved in future versions as we slowly get rid of the :pypi:`py`
278
+
dependency (see :issue:`9283` for a longer discussion).
0 commit comments