Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit note that tmpdir fixture is discouraged in favour of tmp_path #9937 #10138

Merged
merged 2 commits into from Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions AUTHORS
Expand Up @@ -87,6 +87,7 @@ Damian Skrzypczak
Daniel Grana
Daniel Hahler
Daniel Nuri
Daniel Sánchez Castelló
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you adding this many people? Usually PR authors just add themselves. Not sure it is OK to add other people without their consent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nicoddemus, this PR is part of a mob-programming session at @clarityai-eng.

The people involved in the thinking and writing of this change are:
@toclarity - Tatiana
@Wolfremium13 - Kevin
@victorrmclarity - Victor
@DaniSancas - Daniel

Is it correct to write all our names in the AUTHORS section or should we delete some of them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh no worries then, thanks for the clarification. I assume everyone consents to this so it is fine. 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, everyone on the list was in the session and gave their consent.

It's the first time we contribute to this project. Are there any next steps to be done?

Thank you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that's it!

Thanks @toclarity, @Wolfremium13, @victorrmclarity, and @DaniSancas for the contribution! 👍

Daniel Wandschneider
Daniele Procida
Danielle Jenkins
Expand Down Expand Up @@ -190,6 +191,7 @@ Katerina Koukiou
Keri Volans
Kevin C
Kevin Cox
Kevin Hierro Carrasco
Kevin J. Foley
Kian Eliasi
Kian-Meng Ang
Expand Down Expand Up @@ -327,6 +329,7 @@ Taneli Hukkinen
Tanvi Mehta
Tarcisio Fischer
Tareq Alayan
Tatiana Ovary
Ted Xiao
Terje Runde
Thomas Grainger
Expand All @@ -345,6 +348,7 @@ Tyler Goodlet
Tzu-ping Chung
Vasily Kuznetsov
Victor Maryama
Victor Rodriguez
Victor Uriarte
Vidar T. Fauske
Virgil Dupras
Expand Down
1 change: 1 addition & 0 deletions changelog/9937.doc.rst
@@ -0,0 +1 @@
Explicit note that :fixture:`tmpdir` fixture is discouraged in favour of :fixture:`tmp_path`.
6 changes: 4 additions & 2 deletions doc/en/how-to/tmp_path.rst
Expand Up @@ -104,8 +104,10 @@ The ``tmpdir`` and ``tmpdir_factory`` fixtures

The ``tmpdir`` and ``tmpdir_factory`` fixtures are similar to ``tmp_path``
and ``tmp_path_factory``, but use/return legacy `py.path.local`_ objects
rather than standard :class:`pathlib.Path` objects. These days, prefer to
use ``tmp_path`` and ``tmp_path_factory``.
rather than standard :class:`pathlib.Path` objects.

.. note::
These days, it is preferred to use ``tmp_path`` and ``tmp_path_factory``.

See :fixture:`tmpdir <tmpdir>` :fixture:`tmpdir_factory <tmpdir_factory>`
API for details.
Expand Down
14 changes: 13 additions & 1 deletion src/_pytest/legacypath.py
Expand Up @@ -271,7 +271,14 @@ def testdir(pytester: Pytester) -> Testdir:
@attr.s(init=False, auto_attribs=True)
class TempdirFactory:
"""Backward compatibility wrapper that implements :class:`py.path.local`
for :class:`TempPathFactory`."""
for :class:`TempPathFactory`.

.. note::
These days, it is preferred to use ``tmp_path_factory``.

:ref:`About the tmpdir and tmpdir_factory fixtures<tmpdir and tmpdir_factory>`.

"""

_tmppath_factory: TempPathFactory

Expand Down Expand Up @@ -312,6 +319,11 @@ def tmpdir(tmp_path: Path) -> LEGACY_PATH:

The returned object is a `legacy_path`_ object.

.. note::
These days, it is preferred to use ``tmp_path``.

:ref:`About the tmpdir and tmpdir_factory fixtures<tmpdir and tmpdir_factory>`.

.. _legacy_path: https://py.readthedocs.io/en/latest/path.html
"""
return legacy_path(tmp_path)
Expand Down