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:
308
-
309
-
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
310
-
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
311
-
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
312
-
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
313
-
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
314
-
315
-
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.
316
-
317
-
.. note::
318
-
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
319
-
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
320
-
being ``path``) is **the opposite** of the situation for hooks (the old
321
-
argument being ``path``).
322
-
323
-
This is an unfortunate artifact due to historical reasons, which should be
324
-
resolved in future versions as we slowly get rid of the :pypi:`py`
325
-
dependency (see :issue:`9283` for a longer discussion).
326
-
327
300
Directly constructing internal classes
328
301
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329
302
@@ -430,6 +403,34 @@ an appropriate period of deprecation has passed.
430
403
431
404
Some breaking changes which could not be deprecated are also listed.
432
405
406
+
.. _legacy-path-hooks-deprecated:
407
+
408
+
``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:
415
+
416
+
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
417
+
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
418
+
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
419
+
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
420
+
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
421
+
422
+
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.
423
+
424
+
.. note::
425
+
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
426
+
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
427
+
being ``path``) is **the opposite** of the situation for hooks (the old
428
+
argument being ``path``).
429
+
430
+
This is an unfortunate artifact due to historical reasons, which should be
431
+
resolved in future versions as we slowly get rid of the :pypi:`py`
432
+
dependency (see :issue:`9283` for a longer discussion).
0 commit comments