Tweak textwrap.dedent strings
@@ -306,13 +306,14 @@ class TestPipResult:
expected_ending = pkg_dir + "\n."
raise TestFailure(
textwrap.dedent(
- f"""\
+ f"""
Incorrect egg_link file {egg_link_file!r}
Expected ending: {expected_ending!r}
------- Actual contents -------
{egg_link_contents!r}
- -------------------------------"""
- )
+ -------------------------------
+ """
+ ).strip()
)
if use_user_site:
@@ -329,7 +330,7 @@ class TestPipResult:
files = sorted(self.files_created)
raise TestFailure(
textwrap.dedent(
- f"""\
+ f"""
expected package directory {pkg_dir!r} {maybe}to be created
actually created:
{files}
@@ -758,12 +759,10 @@ def _create_main_file(dir_path, name=None, output=None):
if output is None:
output = "0.1"
text = textwrap.dedent(
- """\
+ f"""
def main():
- print({!r})
- """.format(
- output
- )
+ print({output!r})
+ """
)
filename = f"{name}.py"
dir_path.joinpath(filename).write_text(text)
@@ -865,11 +864,14 @@ def _create_test_package_with_subdirectory(script, subdirectory):
textwrap.dedent(
"""
from setuptools import setup, find_packages
- setup(name='version_pkg',
- version='0.1',
+
+ setup(
+ name="version_pkg",
+ version="0.1",
packages=find_packages(),
- py_modules=['version_pkg'],
- entry_points=dict(console_scripts=['version_pkg=version_pkg:main']))
+ py_modules=["version_pkg"],
+ entry_points=dict(console_scripts=["version_pkg=version_pkg:main"]),
+ )
"""
)
)
@@ -881,12 +883,15 @@ def _create_test_package_with_subdirectory(script, subdirectory):
subdirectory_path.joinpath("setup.py").write_text(
textwrap.dedent(
"""
-from setuptools import setup, find_packages
-setup(name='version_subpkg',
- version='0.1',
+ from setuptools import find_packages, setup
+
+ setup(
+ name="version_subpkg",
+ version="0.1",
packages=find_packages(),
- py_modules=['version_subpkg'],
- entry_points=dict(console_scripts=['version_pkg=version_subpkg:main']))
+ py_modules=["version_subpkg"],
+ entry_points=dict(console_scripts=["version_pkg=version_subpkg:main"]),
+ )
"""
)
)
@@ -913,10 +918,10 @@ def _create_test_package_with_srcdir(script, name="version_pkg", vcs="git"):
"""
from setuptools import setup, find_packages
setup(
- name='{name}',
- version='0.1',
+ name="{name}",
+ version="0.1",
packages=find_packages(),
- package_dir={{'': 'src'}},
+ package_dir={{"": "src"}},
)
""".format(
name=name
@@ -935,11 +940,11 @@ def _create_test_package(script, name="version_pkg", vcs="git"):
"""
from setuptools import setup, find_packages
setup(
- name='{name}',
- version='0.1',
+ name="{name}",
+ version="0.1",
packages=find_packages(),
- py_modules=['{name}'],
- entry_points=dict(console_scripts=['{name}={name}:main'])
+ py_modules=["{name}"],
+ entry_points=dict(console_scripts=["{name}={name}:main"]),
)
""".format(
name=name
