Skip to content

Commit 200c0c1

Browse files
kerizaneblueyed
authored andcommitted
Use internal version of make_numbered_dir
(cherry picked from commit 678440e) Conflicts: src/_pytest/pytester/__init__.py
1 parent 18256f0 commit 200c0c1

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Kale Kundert
148148
Karl O. Pinc
149149
Katarzyna Jachim
150150
Katerina Koukiou
151+
Keri Volans
151152
Kevin Cox
152153
Kevin J. Foley
153154
Kodi B. Arfer

src/_pytest/pytester/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
from _pytest.nodes import Item
4949
from _pytest.outcomes import Failed
5050
from _pytest.pathlib import _shorten_path
51+
from _pytest.pathlib import make_numbered_dir
5152
from _pytest.pathlib import Path
5253
from _pytest.python import Function
5354
from _pytest.python import Module
5455
from _pytest.reports import TestReport
5556
from _pytest.tmpdir import TempdirFactory
5657

57-
5858
if TYPE_CHECKING:
5959
from typing import Type
6060
from typing_extensions import Literal # noqa: F401
@@ -1486,9 +1486,7 @@ def runpytest_subprocess(self, *args, stdin=CLOSE_STDIN, timeout=None) -> RunRes
14861486
Returns a :py:class:`RunResult`.
14871487
"""
14881488
__tracebackhide__ = True
1489-
p = py.path.local.make_numbered_dir(
1490-
prefix="runpytest-", keep=None, rootdir=self.tmpdir
1491-
)
1489+
p = make_numbered_dir(root=Path(self.tmpdir), prefix="runpytest-")
14921490
args = ("--basetemp=%s" % p,) + args
14931491
plugins = [x for x in self.plugins if isinstance(x, str)]
14941492
if plugins:

testing/test_assertrewrite.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import zipfile
1111
from functools import partial
1212

13-
import py.path
14-
1513
import _pytest._code
1614
import pytest
1715
from _pytest.assertion import util
@@ -22,6 +20,7 @@
2220
from _pytest.assertion.rewrite import PYTEST_TAG
2321
from _pytest.assertion.rewrite import rewrite_asserts
2422
from _pytest.config import ExitCode
23+
from _pytest.pathlib import make_numbered_dir
2524
from _pytest.pathlib import Path
2625
from _pytest.pytester import Testdir
2726

@@ -848,9 +847,7 @@ def test_optimized():
848847
"hello"
849848
assert test_optimized.__doc__ is None"""
850849
)
851-
p = py.path.local.make_numbered_dir(
852-
prefix="runpytest-", keep=None, rootdir=testdir.tmpdir
853-
)
850+
p = make_numbered_dir(root=Path(testdir.tmpdir), prefix="runpytest-")
854851
tmp = "--basetemp=%s" % p
855852
monkeypatch.setenv("PYTHONOPTIMIZE", "2")
856853
monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)

0 commit comments

Comments
 (0)