mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Minor formatting tweaks (#10190)
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
This commit is contained in:
parent
2de3af1747
commit
a196b3bf01
|
@ -72,10 +72,15 @@ def _log_context(
|
|||
root: Optional[str] = None,
|
||||
prefix: Optional[str] = None,
|
||||
) -> None:
|
||||
message = (
|
||||
"Additional context:" "\nuser = %r" "\nhome = %r" "\nroot = %r" "\nprefix = %r"
|
||||
)
|
||||
logger.log(_MISMATCH_LEVEL, message, user, home, root, prefix)
|
||||
parts = [
|
||||
"Additional context:",
|
||||
"user = %r",
|
||||
"home = %r",
|
||||
"root = %r",
|
||||
"prefix = %r",
|
||||
]
|
||||
|
||||
logger.log(_MISMATCH_LEVEL, "\n".join(parts), user, home, root, prefix)
|
||||
|
||||
|
||||
def get_scheme(
|
||||
|
|
|
@ -83,7 +83,7 @@ def _check_dist_requires_python(
|
|||
version = ".".join(map(str, version_info))
|
||||
if ignore_requires_python:
|
||||
logger.debug(
|
||||
"Ignoring failed Requires-Python check for package %r: " "%s not in %r",
|
||||
"Ignoring failed Requires-Python check for package %r: %s not in %r",
|
||||
dist.project_name,
|
||||
version,
|
||||
requires_python,
|
||||
|
@ -344,7 +344,7 @@ class Resolver(BaseResolver):
|
|||
self._set_req_to_reinstall(req)
|
||||
else:
|
||||
logger.info(
|
||||
"Requirement already satisfied (use --upgrade to upgrade):" " %s",
|
||||
"Requirement already satisfied (use --upgrade to upgrade): %s",
|
||||
req,
|
||||
)
|
||||
return dist
|
||||
|
|
|
@ -1835,8 +1835,8 @@ def test_invalid_index_url_argument(script, shared_data):
|
|||
shared_data.find_links3, "Dinner",
|
||||
expect_error=True)
|
||||
|
||||
assert 'WARNING: The index url "--user" seems invalid, ' \
|
||||
'please provide a scheme.' in result.stderr, str(result)
|
||||
assert ('WARNING: The index url "--user" seems invalid, '
|
||||
'please provide a scheme.') in result.stderr, str(result)
|
||||
|
||||
|
||||
def test_valid_index_url_argument(script, shared_data):
|
||||
|
|
|
@ -289,12 +289,12 @@ class TestPipResult:
|
|||
if without_egg_link:
|
||||
if egg_link_path in self.files_created:
|
||||
raise TestFailure(
|
||||
"unexpected egg link file created: " f"{egg_link_path!r}\n{self}"
|
||||
f"unexpected egg link file created: {egg_link_path!r}\n{self}"
|
||||
)
|
||||
else:
|
||||
if egg_link_path not in self.files_created:
|
||||
raise TestFailure(
|
||||
"expected egg link file missing: " f"{egg_link_path!r}\n{self}"
|
||||
f"expected egg link file missing: {egg_link_path!r}\n{self}"
|
||||
)
|
||||
|
||||
egg_link_file = self.files_created[egg_link_path]
|
||||
|
@ -344,7 +344,7 @@ class TestPipResult:
|
|||
normalized_path = os.path.normpath(pkg_dir / f)
|
||||
if normalized_path not in self.files_created:
|
||||
raise TestFailure(
|
||||
f"Package directory {pkg_dir!r} missing " f"expected content {f!r}"
|
||||
f"Package directory {pkg_dir!r} missing expected content {f!r}"
|
||||
)
|
||||
|
||||
for f in without_files:
|
||||
|
@ -602,7 +602,7 @@ class PipTestEnvironment(TestFileEnvironment):
|
|||
# Then default to allowing logged errors.
|
||||
if allow_stderr_error is not None and not allow_stderr_error:
|
||||
raise RuntimeError(
|
||||
"cannot pass allow_stderr_error=False with " "expect_error=True"
|
||||
"cannot pass allow_stderr_error=False with expect_error=True"
|
||||
)
|
||||
allow_stderr_error = True
|
||||
|
||||
|
@ -610,7 +610,7 @@ class PipTestEnvironment(TestFileEnvironment):
|
|||
# Then default to allowing logged warnings.
|
||||
if allow_stderr_warning is not None and not allow_stderr_warning:
|
||||
raise RuntimeError(
|
||||
"cannot pass allow_stderr_warning=False with " "expect_stderr=True"
|
||||
"cannot pass allow_stderr_warning=False with expect_stderr=True"
|
||||
)
|
||||
allow_stderr_warning = True
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ class TestPipTestEnvironment:
|
|||
"""
|
||||
kwargs = {"allow_stderr_warning": False, arg_name: True}
|
||||
expected_start = (
|
||||
"cannot pass allow_stderr_warning=False with " "allow_stderr_error=True"
|
||||
"cannot pass allow_stderr_warning=False with allow_stderr_error=True"
|
||||
)
|
||||
with assert_error_startswith(RuntimeError, expected_start):
|
||||
script.run("python", **kwargs)
|
||||
|
|
|
@ -196,8 +196,7 @@ def test_keyring_set_password(monkeypatch, response_status, creds,
|
|||
# when _prompt_for_password indicates not to save, we should
|
||||
# never call this function
|
||||
def should_save_password_to_keyring(*a):
|
||||
assert False, ("_should_save_password_to_keyring should not be " +
|
||||
"called")
|
||||
assert False, "_should_save_password_to_keyring should not be called"
|
||||
monkeypatch.setattr(auth, '_should_save_password_to_keyring',
|
||||
should_save_password_to_keyring)
|
||||
|
||||
|
|
|
@ -611,7 +611,7 @@ def test_parse_editable_local_extras(
|
|||
exists_mock.return_value = isdir_mock.return_value = True
|
||||
abspath_mock.return_value = "/some/path"
|
||||
assert parse_editable('.[extras]') == (
|
||||
None, 'file://' + "/some/path", {'extras'},
|
||||
None, "file:///some/path", {'extras'},
|
||||
)
|
||||
abspath_mock.return_value = "/some/path/foo"
|
||||
assert parse_editable('foo[bar,baz]') == (
|
||||
|
|
|
@ -312,8 +312,10 @@ class TestProcessLine:
|
|||
assert reqs[0].constraint
|
||||
|
||||
def test_options_on_a_requirement_line(self, line_processor):
|
||||
line = 'SomeProject --install-option=yo1 --install-option yo2 '\
|
||||
'--global-option="yo3" --global-option "yo4"'
|
||||
line = (
|
||||
'SomeProject --install-option=yo1 --install-option yo2 '
|
||||
'--global-option="yo3" --global-option "yo4"'
|
||||
)
|
||||
filename = 'filename'
|
||||
req = line_processor(line, filename, 1)[0]
|
||||
assert req.global_options == ['yo3', 'yo4']
|
||||
|
|
Loading…
Reference in a new issue