Skip to content

Commit dea08d7

Browse files
committed
Fix formatting errors
1 parent 5022126 commit dea08d7

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

setuptools/tests/test_egg_info.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ def test_provides_extra(self, tmpdir_cwd, env):
538538
env=environ,
539539
)
540540
egg_info_dir = os.path.join('.', 'foo.egg-info')
541-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
542-
pkg_info_lines = pkginfo_file.read().split('\n')
541+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
542+
pkg_info_lines = fp.read().split('\n')
543543
assert 'Provides-Extra: foobar' in pkg_info_lines
544544
assert 'Metadata-Version: 2.1' in pkg_info_lines
545545

@@ -557,8 +557,8 @@ def test_doesnt_provides_extra(self, tmpdir_cwd, env):
557557
env=environ,
558558
)
559559
egg_info_dir = os.path.join('.', 'foo.egg-info')
560-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
561-
pkg_info_text = pkginfo_file.read()
560+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
561+
pkg_info_text = fp.read()
562562
assert 'Provides-Extra:' not in pkg_info_text
563563

564564
@pytest.mark.parametrize(
@@ -636,8 +636,7 @@ def test_setup_cfg_license_file(self, tmpdir_cwd, env, files, license_in_sources
636636
)
637637
egg_info_dir = os.path.join('.', 'foo.egg-info')
638638

639-
with open(os.path.join(egg_info_dir, 'SOURCES.txt'), encoding="utf-8") as sources_file:
640-
sources_text = sources_file.read()
639+
sources_text = Path(egg_info_dir, "SOURCES.txt").read_text(encoding="utf-8")
641640

642641
if license_in_sources:
643642
assert 'LICENSE' in sources_text
@@ -849,8 +848,8 @@ def test_setup_cfg_license_files(
849848
)
850849
egg_info_dir = os.path.join('.', 'foo.egg-info')
851850

852-
with open(os.path.join(egg_info_dir, 'SOURCES.txt'), encoding="utf-8") as sources_file:
853-
sources_lines = list(line.strip() for line in sources_file)
851+
sources_text = Path(egg_info_dir, "SOURCES.txt").read_text(encoding="utf-8")
852+
sources_lines = [line.strip() for line in sources_text.splitlines()]
854853

855854
for lf in incl_licenses:
856855
assert sources_lines.count(lf) == 1
@@ -1033,8 +1032,8 @@ def test_setup_cfg_license_file_license_files(
10331032
)
10341033
egg_info_dir = os.path.join('.', 'foo.egg-info')
10351034

1036-
with open(os.path.join(egg_info_dir, 'SOURCES.txt'), encoding="utf-8") as sources_file:
1037-
sources_lines = list(line.strip() for line in sources_file)
1035+
sources_text = Path(egg_info_dir, "SOURCES.txt").read_text(encoding="utf-8")
1036+
sources_lines = [line.strip() for line in sources_text.splitlines()]
10381037

10391038
for lf in incl_licenses:
10401039
assert sources_lines.count(lf) == 1
@@ -1065,8 +1064,8 @@ def test_license_file_attr_pkg_info(self, tmpdir_cwd, env):
10651064
pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
10661065
)
10671066
egg_info_dir = os.path.join('.', 'foo.egg-info')
1068-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1069-
pkg_info_lines = pkginfo_file.read().split('\n')
1067+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1068+
pkg_info_lines = fp.read().split('\n')
10701069
license_file_lines = [
10711070
line for line in pkg_info_lines if line.startswith('License-File:')
10721071
]
@@ -1086,8 +1085,8 @@ def test_metadata_version(self, tmpdir_cwd, env):
10861085
data_stream=1,
10871086
)
10881087
egg_info_dir = os.path.join('.', 'foo.egg-info')
1089-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1090-
pkg_info_lines = pkginfo_file.read().split('\n')
1088+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1089+
pkg_info_lines = fp.read().split('\n')
10911090
# Update metadata version if changed
10921091
assert self._extract_mv_version(pkg_info_lines) == (2, 1)
10931092

@@ -1112,8 +1111,8 @@ def test_long_description_content_type(self, tmpdir_cwd, env):
11121111
env=environ,
11131112
)
11141113
egg_info_dir = os.path.join('.', 'foo.egg-info')
1115-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1116-
pkg_info_lines = pkginfo_file.read().split('\n')
1114+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1115+
pkg_info_lines = fp.read().split('\n')
11171116
expected_line = 'Description-Content-Type: text/markdown'
11181117
assert expected_line in pkg_info_lines
11191118
assert 'Metadata-Version: 2.1' in pkg_info_lines
@@ -1133,8 +1132,8 @@ def test_long_description(self, tmpdir_cwd, env):
11331132
data_stream=1,
11341133
)
11351134
egg_info_dir = os.path.join('.', 'foo.egg-info')
1136-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1137-
pkg_info_lines = pkginfo_file.read().split('\n')
1135+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1136+
pkg_info_lines = fp.read().split('\n')
11381137
assert 'Metadata-Version: 2.1' in pkg_info_lines
11391138
assert '' == pkg_info_lines[-1] # last line should be empty
11401139
long_desc_lines = pkg_info_lines[pkg_info_lines.index('') :]
@@ -1165,8 +1164,8 @@ def test_project_urls(self, tmpdir_cwd, env):
11651164
env=environ,
11661165
)
11671166
egg_info_dir = os.path.join('.', 'foo.egg-info')
1168-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1169-
pkg_info_lines = pkginfo_file.read().split('\n')
1167+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1168+
pkg_info_lines = fp.read().split('\n')
11701169
expected_line = 'Project-URL: Link One, https://example.com/one/'
11711170
assert expected_line in pkg_info_lines
11721171
expected_line = 'Project-URL: Link Two, https://example.com/two/'
@@ -1182,8 +1181,8 @@ def test_license(self, tmpdir_cwd, env):
11821181
data_stream=1,
11831182
)
11841183
egg_info_dir = os.path.join('.', 'foo.egg-info')
1185-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1186-
pkg_info_lines = pkginfo_file.read().split('\n')
1184+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1185+
pkg_info_lines = fp.read().split('\n')
11871186
assert 'License: MIT' in pkg_info_lines
11881187

11891188
def test_license_escape(self, tmpdir_cwd, env):
@@ -1197,8 +1196,8 @@ def test_license_escape(self, tmpdir_cwd, env):
11971196
data_stream=1,
11981197
)
11991198
egg_info_dir = os.path.join('.', 'foo.egg-info')
1200-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1201-
pkg_info_lines = pkginfo_file.read().split('\n')
1199+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1200+
pkg_info_lines = fp.read().split('\n')
12021201

12031202
assert 'License: This is a long license text ' in pkg_info_lines
12041203
assert ' over multiple lines' in pkg_info_lines
@@ -1216,8 +1215,8 @@ def test_python_requires_egg_info(self, tmpdir_cwd, env):
12161215
env=environ,
12171216
)
12181217
egg_info_dir = os.path.join('.', 'foo.egg-info')
1219-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1220-
pkg_info_lines = pkginfo_file.read().split('\n')
1218+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1219+
pkg_info_lines = fp.read().split('\n')
12211220
assert 'Requires-Python: >=2.7.12' in pkg_info_lines
12221221
assert self._extract_mv_version(pkg_info_lines) >= (1, 2)
12231222

@@ -1277,8 +1276,8 @@ def test_egg_info_tag_only_once(self, tmpdir_cwd, env):
12771276
})
12781277
self._run_egg_info_command(tmpdir_cwd, env)
12791278
egg_info_dir = os.path.join('.', 'foo.egg-info')
1280-
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as pkginfo_file:
1281-
pkg_info_lines = pkginfo_file.read().split('\n')
1279+
with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1280+
pkg_info_lines = fp.read().split('\n')
12821281
assert 'Version: 0.0.0.dev0' in pkg_info_lines
12831282

12841283

setuptools/tests/test_manifest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ def setup_method(self, method):
212212

213213
def make_manifest(self, contents):
214214
"""Write a MANIFEST.in."""
215-
with open(os.path.join(self.temp_dir, 'MANIFEST.in'), 'w', encoding="utf-8") as f:
215+
manifest = os.path.join(self.temp_dir, 'MANIFEST.in')
216+
with open(manifest, 'w', encoding="utf-8") as f:
216217
f.write(DALS(contents))
217218

218219
def get_files(self):

0 commit comments

Comments
 (0)