Skip to content

Commit 1ff0924

Browse files
committed
Replace Python 2 tmpdir removal workarounds
1 parent 5ccd226 commit 1ff0924

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

tests/conftest.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,8 @@ def tmpdir_factory(request, tmpdir_factory):
129129
"""
130130
yield tmpdir_factory
131131
if not request.config.getoption("--keep-tmpdir"):
132-
# py.path.remove() uses str paths on Python 2 and cannot
133-
# handle non-ASCII file names. This works around the problem by
134-
# passing a unicode object to rmtree().
135132
shutil.rmtree(
136-
str(tmpdir_factory.getbasetemp()),
133+
tmpdir_factory.getbasetemp(),
137134
ignore_errors=True,
138135
)
139136

@@ -155,10 +152,7 @@ def tmpdir(request, tmpdir):
155152
# This should prevent us from needing a multiple gigabyte temporary
156153
# directory while running the tests.
157154
if not request.config.getoption("--keep-tmpdir"):
158-
# py.path.remove() uses str paths on Python 2 and cannot
159-
# handle non-ASCII file names. This works around the problem by
160-
# passing a unicode object to rmtree().
161-
shutil.rmtree(str(tmpdir), ignore_errors=True)
155+
tmpdir.remove(ignore_errors=True)
162156

163157

164158
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)