diff --git a/tests/conftest.py b/tests/conftest.py index 0bb69dae6d7..edf0ee05099 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -129,11 +129,8 @@ def tmpdir_factory(request, tmpdir_factory): """ yield tmpdir_factory if not request.config.getoption("--keep-tmpdir"): - # py.path.remove() uses str paths on Python 2 and cannot - # handle non-ASCII file names. This works around the problem by - # passing a unicode object to rmtree(). shutil.rmtree( - str(tmpdir_factory.getbasetemp()), + tmpdir_factory.getbasetemp(), ignore_errors=True, ) @@ -155,10 +152,7 @@ def tmpdir(request, tmpdir): # This should prevent us from needing a multiple gigabyte temporary # directory while running the tests. if not request.config.getoption("--keep-tmpdir"): - # py.path.remove() uses str paths on Python 2 and cannot - # handle non-ASCII file names. This works around the problem by - # passing a unicode object to rmtree(). - shutil.rmtree(str(tmpdir), ignore_errors=True) + tmpdir.remove(ignore_errors=True) @pytest.fixture(autouse=True)