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

Change Path.makedirs() -> Path.mkdir(parents=True) #6701

Merged
merged 1 commit into from
Jul 13, 2019
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
2 changes: 1 addition & 1 deletion tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ def test_install_editable_with_prefix(script):

# make sure target path is in PYTHONPATH
pythonpath = script.scratch_path / site_packages
pythonpath.makedirs()
pythonpath.mkdir(parents=True)
script.environ["PYTHONPATH"] = pythonpath

# install pkga package into the absolute prefix directory
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_uninstall_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_uninstall_editable_from_usersite(self, script, data):
"""
Test uninstall editable local user install
"""
script.user_site_path.makedirs()
script.user_site_path.mkdir(parents=True)

# install
to_install = data.packages.joinpath("FSPkg")
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def auto_with_wheel(with_wheel):


def add_files_to_dist_directory(folder):
(folder / 'dist').makedirs()
(folder / 'dist').mkdir(parents=True)
(folder / 'dist' / 'a_name-0.0.1.tar.gz').write_text("hello")
# Not adding a wheel file since that confuses setuptools' backend.
# (folder / 'dist' / 'a_name-0.0.1-py2.py3-none-any.whl').write_text(
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def __init__(self, base_path, *args, **kwargs):

# create easy-install.pth in user_site, so we always have it updated
# instead of created
self.user_site_path.makedirs()
self.user_site_path.mkdir(parents=True)
self.user_site_path.joinpath("easy-install.pth").touch()

def _ignore_file(self, fn):
Expand Down
17 changes: 7 additions & 10 deletions tests/lib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,17 @@ def exists(self):
"""
return os.path.exists(self)

def mkdir(self, mode=0x1FF): # 0o777
def mkdir(self, mode=0x1FF, parents=False): # 0o777
"""
Creates a directory, if it doesn't exist already.
"""
if not self.exists():
os.mkdir(self, mode)
return self

def makedirs(self, mode=0x1FF): # 0o777
:param parents: Whether to create parent directories.
"""
Like mkdir(), but also creates parent directories.
"""
if not self.exists():
os.makedirs(self, mode)
if self.exists():
return self

maker_func = os.makedirs if parents else os.mkdir
maker_func(self, mode)
return self

def unlink(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _create(self, clear=False):
context = builder.ensure_directories(self.location)
builder.create_configuration(context)
builder.setup_python(context)
self.site.makedirs()
self.site.mkdir(parents=True)
self.sitecustomize = self._sitecustomize
self.user_site_packages = self._user_site_packages

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@pytest.fixture(scope="function")
def cache_tmpdir(tmpdir):
cache_dir = tmpdir.joinpath("cache")
cache_dir.makedirs()
cache_dir.mkdir(parents=True)
yield cache_dir


Expand Down