diff --git a/pipenv/resolver.py b/pipenv/resolver.py index 501e0219..08c16e57 100644 --- a/pipenv/resolver.py +++ b/pipenv/resolver.py @@ -315,7 +315,7 @@ class Entry: return "*" specifier = f"=={specifier}" elif specifier.startswith("==") and specifier.count("=") > 3: - specifier = "=={}".format(specifier.lstrip("=")) + specifier = f"=={specifier.lstrip('=')}" return specifier @staticmethod @@ -476,13 +476,8 @@ class Entry: if self.project.s.is_verbose(): err.print(f"Tried constraint: {constraint!r}") msg = ( - "Cannot resolve conflicting version {}{} while {}{} is " - "locked.".format( - self.name, - constraint.specifier, - self.name, - self.updated_specifier, - ) + f"Cannot resolve conflicting version {self.name}{constraint.specifier} " + f"while {self.name}{self.updated_specifier} is locked." ) raise DependencyConflict(msg) return True @@ -495,14 +490,9 @@ class Entry: from pipenv.exceptions import DependencyConflict msg = ( - "Cannot resolve conflicting versions: (Root: {}) {}{} (Pipfile) " - "Incompatible with {}{} (resolved)\n".format( - self.name, - parent.pipfile_name, - parent.pipfile_entry.requirement.specifiers, - parent.name, - parent.updated_specifiers, - ) + f"Cannot resolve conflicting versions: (Root: {self.name}) " + f"{parent.pipfile_name}{parent.pipfile_entry.requirement.specifiers} (Pipfile) " + f"Incompatible with {parent.name}{parent.updated_specifiers} (resolved)\n" ) raise DependencyConflict(msg) diff --git a/pipenv/utils/funktools.py b/pipenv/utils/funktools.py index be40778e..3c8201d0 100644 --- a/pipenv/utils/funktools.py +++ b/pipenv/utils/funktools.py @@ -149,7 +149,7 @@ def _get_powershell_path(): ] powershell_path = next(iter(_walk_for_powershell(pth) for pth in paths), None) if not powershell_path: - powershell_path = subprocess.run(["where", "powershell"]) + powershell_path = subprocess.run(["where", "powershell"], check=False) if powershell_path.stdout: return powershell_path.stdout.strip() @@ -165,7 +165,7 @@ def _get_sid_with_powershell(): "-Command", "Invoke-Expression '[System.Security.Principal.WindowsIdentity]::GetCurrent().user | Write-Host'", ] - sid = subprocess.run(args, capture_output=True) + sid = subprocess.run(args, capture_output=True, check=False) return sid.stdout.strip() @@ -289,6 +289,7 @@ def set_write_bit(fn: str) -> None: # >>> sys.stdout.encoding # "UTF8" encoding=locale.getpreferredencoding(), + check=False, ) if not c.err and c.returncode == 0: return diff --git a/pipenv/utils/processes.py b/pipenv/utils/processes.py index f061be50..9c0ea837 100644 --- a/pipenv/utils/processes.py +++ b/pipenv/utils/processes.py @@ -69,7 +69,9 @@ def subprocess_run( other_kwargs["stdout"] = subprocess.PIPE other_kwargs["stderr"] = subprocess.PIPE if block: - return subprocess.run(args, text=text, encoding=encoding, **other_kwargs) + return subprocess.run( + args, text=text, encoding=encoding, check=False, **other_kwargs + ) else: return subprocess.Popen( args, universal_newlines=text, encoding=encoding, **other_kwargs diff --git a/pipenv/utils/resolver.py b/pipenv/utils/resolver.py index 97fa7883..49199422 100644 --- a/pipenv/utils/resolver.py +++ b/pipenv/utils/resolver.py @@ -144,8 +144,8 @@ class Resolver: def __repr__(self): return ( - "".format(self=self) + f"" ) @staticmethod diff --git a/pipenv/utils/toml.py b/pipenv/utils/toml.py index e1261469..ddddc6c7 100644 --- a/pipenv/utils/toml.py +++ b/pipenv/utils/toml.py @@ -130,8 +130,7 @@ def tomlkit_dict_to_python(toml_dict): converted = toml_dict.copy() else: raise TypeError( - "Invalid type for conversion: expected Container, Dict, or Table, " - "got {!r}".format(toml_dict) + f"Invalid type for conversion: expected Container, Dict, or Table, got {toml_dict}" ) if isinstance(converted, dict): return {k: tomlkit_value_to_python(v) for k, v in converted.items()} diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 56d1ec71..51cfadbc 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -236,7 +236,7 @@ class _PipenvInstance: self._path = None def run_command(self, cmd): - result = subprocess.run(cmd, shell=True, capture_output=True) + result = subprocess.run(cmd, shell=True, capture_output=True, check=False) try: std_out_decoded = result.stdout.decode("utf-8") except UnicodeDecodeError: diff --git a/tests/integration/test_install_categories.py b/tests/integration/test_install_categories.py index 4fa39d77..6d52d680 100644 --- a/tests/integration/test_install_categories.py +++ b/tests/integration/test_install_categories.py @@ -1,5 +1,4 @@ import os -import tempfile import pytest @@ -23,7 +22,7 @@ def test_basic_category_install_from_requirements(pipenv_instance_private_pypi): with pipenv_instance_private_pypi(pipfile=False) as p: # Write a requirements file with open("requirements.txt", "w") as f: - f.write(f"six==1.16.0") + f.write("six==1.16.0") c = p.pipenv("install --categories prereq") assert c.returncode == 0