mirror of https://github.com/pypa/pip
Remove rmtree from tests.lib.path.Path.
This commit is contained in:
parent
645809944c
commit
9d37e3ced2
|
@ -115,7 +115,7 @@ def test_pep518_with_user_pip(script, pip_src, data, common_wheels):
|
|||
script.pip("install", "--ignore-installed",
|
||||
"-f", common_wheels, "--user", pip_src)
|
||||
system_pip_dir = script.site_packages_path / 'pip'
|
||||
system_pip_dir.rmtree()
|
||||
assert not system_pip_dir.exists()
|
||||
system_pip_dir.mkdir()
|
||||
with open(system_pip_dir / '__init__.py', 'w') as fp:
|
||||
fp.write('raise ImportError\n')
|
||||
|
|
|
@ -139,7 +139,10 @@ class TestData(object):
|
|||
return obj
|
||||
|
||||
def reset(self):
|
||||
self.root.rmtree()
|
||||
# Check explicitly for the target directory to avoid overly-broad
|
||||
# try/except.
|
||||
if self.root.exists():
|
||||
shutil.rmtree(self.root)
|
||||
self.source.copytree(self.root)
|
||||
|
||||
@property
|
||||
|
@ -948,7 +951,7 @@ def create_basic_wheel_for_package(script, name, version,
|
|||
generated = shutil.make_archive(retval, 'zip', script.temp_path)
|
||||
shutil.move(generated, retval)
|
||||
|
||||
script.temp_path.rmtree()
|
||||
shutil.rmtree(script.temp_path)
|
||||
script.temp_path.mkdir()
|
||||
|
||||
return retval
|
||||
|
|
|
@ -186,12 +186,6 @@ class Path(_base):
|
|||
"""
|
||||
return os.rmdir(self)
|
||||
|
||||
def rmtree(self, noerrors=True):
|
||||
"""
|
||||
Removes a directory tree. Ignores errors by default.
|
||||
"""
|
||||
return shutil.rmtree(self, ignore_errors=noerrors)
|
||||
|
||||
def copy(self, to):
|
||||
return shutil.copy(self, to)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import compileall
|
||||
import shutil
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
|
@ -47,7 +48,7 @@ class VirtualEnvironment(object):
|
|||
|
||||
def _create(self, clear=False):
|
||||
if clear:
|
||||
self.location.rmtree()
|
||||
shutil.rmtree(self.location)
|
||||
if self._template:
|
||||
# On Windows, calling `_virtualenv.path_locations(target)`
|
||||
# will have created the `target` directory...
|
||||
|
|
Loading…
Reference in New Issue