Fix ruff warnings in tests/integration

This commit is contained in:
Oz Tiram
2023-07-23 08:31:31 +02:00
parent 0fbb9b30be
commit e74a282e09
5 changed files with 22 additions and 27 deletions
+3 -3
View File
@@ -7,15 +7,15 @@ def test_install_uri_with_extras(pipenv_instance_private_pypi):
file_uri = "http://localhost:8080/packages/plette/plette-0.2.2-py2.py3-none-any.whl"
with pipenv_instance_private_pypi() as p:
with open(p.pipfile_path, 'w') as f:
contents = """
contents = f"""
[[source]]
url = "{index}"
url = "{p.index_url}"
verify_ssl = false
name = "testindex"
[packages]
plette = {{file = "{file_uri}", extras = ["validation"]}}
""".format(file_uri=file_uri, index=p.index_url)
"""
f.write(contents)
c = p.pipenv("install")
assert c.returncode == 0
+3 -5
View File
@@ -210,13 +210,11 @@ def test_install_local_uri_special_character(pipenv_instance_private_pypi, tests
os.makedirs(artifact_path, exist_ok=True)
shutil.copy(source_path, os.path.join(artifact_path, file_name))
with open(p.pipfile_path, "w") as f:
contents = """
contents = f"""
# Pre comment
[packages]
six = {{path = "./artifacts/{}"}}
""".format(
file_name
)
six = {{path = "./artifacts/{file_name}"}}
"""
f.write(contents.strip())
c = p.pipenv("install")
assert c.returncode == 0
+3 -3
View File
@@ -219,7 +219,7 @@ def test_vcs_entry_supersedes_non_vcs(pipenv_instance_pypi):
jinja2_uri = p._pipfile.get_fixture_path("git/jinja2").as_uri()
with open(p.pipfile_path, "w") as f:
f.write(
"""
f"""
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
@@ -227,8 +227,8 @@ name = "pypi"
[packages]
Flask = "*"
Jinja2 = {{ref = "2.11.0", git = "{}"}}
""".format(jinja2_uri).strip()
Jinja2 = {{ref = "2.11.0", git = "{jinja2_uri}"}}
""".strip()
)
c = p.pipenv("install")
assert c.returncode == 0
+6 -6
View File
@@ -477,15 +477,15 @@ def test_vcs_lock_respects_top_level_pins(pipenv_instance_private_pypi):
@pytest.mark.lock
def test_lock_after_update_source_name(pipenv_instance_pypi):
with pipenv_instance_pypi() as p:
contents = """
contents = f"""
[[source]]
url = "{}"
url = "{p.index_url}"
verify_ssl = true
name = "test"
[packages]
six = "*"
""".format(p.index_url).strip()
""".strip()
with open(p.pipfile_path, 'w') as f:
f.write(contents)
c = p.pipenv("lock")
@@ -644,9 +644,9 @@ requests = "*"
@pytest.mark.lock
def test_lock_specific_named_category(pipenv_instance_private_pypi):
with pipenv_instance_private_pypi(pipfile=False) as p:
contents = """
contents = f"""
[[source]]
url = "{}"
url = "{p.index_url}"
verify_ssl = true
name = "test"
@@ -655,7 +655,7 @@ requests = "*"
[prereq]
six = "*"
""".format(p.index_url).strip()
""".strip()
with open(p.pipfile_path, 'w') as f:
f.write(contents)
c = p.pipenv("lock --categories prereq")
+7 -10
View File
@@ -38,9 +38,9 @@ pytz = "*"
def test_get_source(pipenv_instance_private_pypi, lock_first):
with pipenv_instance_private_pypi() as p:
with open(p.pipfile_path, 'w') as f:
contents = """
contents = f"""
[[source]]
url = "{}"
url = "{p.index_url}"
verify_ssl = false
name = "testindex"
@@ -54,7 +54,7 @@ pytz = "*"
six = {{version = "*", index = "pypi"}}
[dev-packages]
""".format(p.index_url).strip()
""".strip()
f.write(contents)
if lock_first:
@@ -106,10 +106,7 @@ def test_maintain_file_line_endings(pipenv_instance_pypi, newlines):
with open(fn) as f:
f.read() # Consumes the content to detect newlines.
actual_newlines = f.newlines
assert actual_newlines == newlines, '{!r} != {!r} for {}'.format(
actual_newlines, newlines, fn,
)
# message because of https://github.com/pytest-dev/pytest/issues/3443
assert actual_newlines == newlines, f'{actual_newlines!r} != {newlines!r} for {fn}'
@pytest.mark.project
@@ -118,9 +115,9 @@ def test_maintain_file_line_endings(pipenv_instance_pypi, newlines):
def test_many_indexes(pipenv_instance_pypi):
with pipenv_instance_pypi() as p:
with open(p.pipfile_path, 'w') as f:
contents = """
contents = f"""
[[source]]
url = "{}"
url = "{p.index_url}"
verify_ssl = false
name = "testindex"
@@ -139,7 +136,7 @@ pytz = "*"
six = {{version = "*", index = "pypi"}}
[dev-packages]
""".format(p.index_url).strip()
""".strip()
f.write(contents)
c = p.pipenv('install')
assert c.returncode == 0