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:
345
-
346
-
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
347
-
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
348
-
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
349
-
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
350
-
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
351
-
352
-
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.
353
-
354
-
.. note::
355
-
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
356
-
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
357
-
being ``path``) is **the opposite** of the situation for hooks (the old
358
-
argument being ``path``).
359
-
360
-
This is an unfortunate artifact due to historical reasons, which should be
361
-
resolved in future versions as we slowly get rid of the :pypi:`py`
362
-
dependency (see :issue:`9283` for a longer discussion).
363
-
364
337
Directly constructing internal classes
365
338
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
366
339
@@ -431,10 +404,30 @@ conflicts (such as :class:`pytest.File` now taking ``path`` instead of
431
404
``fspath``, as :ref:`outlined above <node-ctor-fspath-deprecation>`), a
432
405
deprecation warning is now raised.
433
406
407
+
408
+
The ``yield_fixture`` function/decorator
409
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410
+
411
+
.. deprecated:: 6.2
412
+
413
+
``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture`.
414
+
415
+
It has been so for a very long time, so can be search/replaced safely.
416
+
417
+
418
+
Removed Features and Breaking Changes
419
+
-------------------------------------
420
+
421
+
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
422
+
an appropriate period of deprecation has passed.
423
+
424
+
Some breaking changes which could not be deprecated are also listed.
425
+
434
426
Applying a mark to a fixture function
435
427
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
436
428
437
429
.. deprecated:: 7.4
430
+
.. versionremoved:: 9.0
438
431
439
432
Applying a mark to a fixture function never had any effect, but it is a common user error.
440
433
@@ -448,24 +441,33 @@ Users expected in this case that the ``usefixtures`` mark would have its intende
448
441
449
442
Now pytest will issue a warning when it encounters this problem, and will raise an error in the future versions.
450
443
444
+
.. _legacy-path-hooks-deprecated:
451
445
452
-
The ``yield_fixture`` function/decorator
453
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
454
-
455
-
.. deprecated:: 6.2
446
+
``py.path.local`` arguments for hooks replaced with ``pathlib.Path``
``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture`.
449
+
.. deprecated:: 7.0
450
+
.. versionremoved:: 9.0
458
451
459
-
It has been so for a very long time, so can be search/replaced safely.
452
+
In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the following hooks now receive additional arguments:
460
453
454
+
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
455
+
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
456
+
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
457
+
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
458
+
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
461
459
462
-
Removed Features and Breaking Changes
463
-
-------------------------------------
460
+
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.
464
461
465
-
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
466
-
an appropriate period of deprecation has passed.
462
+
.. note::
463
+
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
464
+
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
465
+
being ``path``) is **the opposite** of the situation for hooks (the old
466
+
argument being ``path``).
467
467
468
-
Some breaking changes which could not be deprecated are also listed.
468
+
This is an unfortunate artifact due to historical reasons, which should be
469
+
resolved in future versions as we slowly get rid of the :pypi:`py`
470
+
dependency (see :issue:`9283` for a longer discussion).
0 commit comments