@@ -21,7 +21,9 @@ def test_regex(self):
2121 <a href="http://some_url">Name</a>
2222 (<a title="MD5 hash"
2323 href="{hash_url}">md5</a>)
24- """ .lstrip ().format (** locals ())
24+ """ .lstrip ().format (
25+ ** locals ()
26+ )
2527 assert setuptools .package_index .PYPI_MD5 .match (doc )
2628
2729 def test_bad_url_bad_port (self ):
@@ -38,9 +40,7 @@ def test_bad_url_typo(self):
3840 # issue 16
3941 # easy_install inquant.contentmirror.plone breaks because of a typo
4042 # in its home URL
41- index = setuptools .package_index .PackageIndex (
42- hosts = ('www.example.com' ,)
43- )
43+ index = setuptools .package_index .PackageIndex (hosts = ('www.example.com' ,))
4444
4545 url = (
4646 'url:%20https://svn.plone.org/svn'
@@ -54,9 +54,7 @@ def test_bad_url_typo(self):
5454 assert isinstance (v , urllib .error .HTTPError )
5555
5656 def test_bad_url_bad_status_line (self ):
57- index = setuptools .package_index .PackageIndex (
58- hosts = ('www.example.com' ,)
59- )
57+ index = setuptools .package_index .PackageIndex (hosts = ('www.example.com' ,))
6058
6159 def _urlopen (* args ):
6260 raise http .client .BadStatusLine ('line' )
@@ -74,9 +72,7 @@ def test_bad_url_double_scheme(self):
7472 """
7573 A bad URL with a double scheme should raise a DistutilsError.
7674 """
77- index = setuptools .package_index .PackageIndex (
78- hosts = ('www.example.com' ,)
79- )
75+ index = setuptools .package_index .PackageIndex (hosts = ('www.example.com' ,))
8076
8177 # issue 20
8278 url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk'
@@ -93,22 +89,17 @@ def test_bad_url_double_scheme(self):
9389 raise RuntimeError ("Did not raise" )
9490
9591 def test_bad_url_screwy_href (self ):
96- index = setuptools .package_index .PackageIndex (
97- hosts = ('www.example.com' ,)
98- )
92+ index = setuptools .package_index .PackageIndex (hosts = ('www.example.com' ,))
9993
10094 # issue #160
10195 if sys .version_info [0 ] == 2 and sys .version_info [1 ] == 7 :
10296 # this should not fail
10397 url = 'http://example.com'
104- page = ('<a href="http://www.famfamfam.com]('
105- 'http://www.famfamfam.com/">' )
98+ page = '<a href="http://www.famfamfam.com](' 'http://www.famfamfam.com/">'
10699 index .process_index (url , page )
107100
108101 def test_url_ok (self ):
109- index = setuptools .package_index .PackageIndex (
110- hosts = ('www.example.com' ,)
111- )
102+ index = setuptools .package_index .PackageIndex (hosts = ('www.example.com' ,))
112103 url = 'file:///tmp/test_package_index'
113104 assert index .url_ok (url , True )
114105
@@ -169,9 +160,7 @@ def test_egg_fragment(self):
169160 'b0' ,
170161 'rc0' ,
171162 ]
172- post = [
173- '.post0'
174- ]
163+ post = ['.post0' ]
175164 dev = [
176165 '.dev0' ,
177166 ]
@@ -186,10 +175,14 @@ def test_egg_fragment(self):
186175 for e in epoch
187176 for r in releases
188177 for p in sum ([pre , post , dev ], ['' ])
189- for locs in local ]
178+ for locs in local
179+ ]
190180 for v , vc in versions :
191- dists = list (setuptools .package_index .distros_for_url (
192- 'http://example.com/example.zip#egg=example-' + v ))
181+ dists = list (
182+ setuptools .package_index .distros_for_url (
183+ 'http://example.com/example.zip#egg=example-' + v
184+ )
185+ )
193186 assert dists [0 ].version == ''
194187 assert dists [1 ].version == vc
195188
@@ -204,8 +197,7 @@ def test_download_git_with_rev(self, tmpdir):
204197
205198 expected_dir = str (tmpdir / 'project@master' )
206199 expected = (
207- 'git clone --quiet '
208- 'https://github.example/group/project {expected_dir}'
200+ 'git clone --quiet ' 'https://github.example/group/project {expected_dir}'
209201 ).format (** locals ())
210202 first_call_args = os_system_mock .call_args_list [0 ][0 ]
211203 assert first_call_args == (expected ,)
@@ -226,8 +218,7 @@ def test_download_git_no_rev(self, tmpdir):
226218
227219 expected_dir = str (tmpdir / 'project' )
228220 expected = (
229- 'git clone --quiet '
230- 'https://github.example/group/project {expected_dir}'
221+ 'git clone --quiet ' 'https://github.example/group/project {expected_dir}'
231222 ).format (** locals ())
232223 os_system_mock .assert_called_once_with (expected )
233224
@@ -243,42 +234,44 @@ def test_download_svn(self, tmpdir):
243234
244235 expected_dir = str (tmpdir / 'project' )
245236 expected = (
246- 'svn checkout -q '
247- 'svn+https://svn.example/project {expected_dir}'
237+ 'svn checkout -q ' 'svn+https://svn.example/project {expected_dir}'
248238 ).format (** locals ())
249239 os_system_mock .assert_called_once_with (expected )
250240
251241
252242class TestContentCheckers :
253243 def test_md5 (self ):
254244 checker = setuptools .package_index .HashChecker .from_url (
255- 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478' )
245+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478'
246+ )
256247 checker .feed ('You should probably not be using MD5' .encode ('ascii' ))
257248 assert checker .hash .hexdigest () == 'f12895fdffbd45007040d2e44df98478'
258249 assert checker .is_valid ()
259250
260251 def test_other_fragment (self ):
261252 "Content checks should succeed silently if no hash is present"
262253 checker = setuptools .package_index .HashChecker .from_url (
263- 'http://foo/bar#something%20completely%20different' )
254+ 'http://foo/bar#something%20completely%20different'
255+ )
264256 checker .feed ('anything' .encode ('ascii' ))
265257 assert checker .is_valid ()
266258
267259 def test_blank_md5 (self ):
268260 "Content checks should succeed if a hash is empty"
269- checker = setuptools .package_index .HashChecker .from_url (
270- 'http://foo/bar#md5=' )
261+ checker = setuptools .package_index .HashChecker .from_url ('http://foo/bar#md5=' )
271262 checker .feed ('anything' .encode ('ascii' ))
272263 assert checker .is_valid ()
273264
274265 def test_get_hash_name_md5 (self ):
275266 checker = setuptools .package_index .HashChecker .from_url (
276- 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478' )
267+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478'
268+ )
277269 assert checker .hash_name == 'md5'
278270
279271 def test_report (self ):
280272 checker = setuptools .package_index .HashChecker .from_url (
281- 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478' )
273+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478'
274+ )
282275 rep = checker .report (lambda x : x , 'My message about %s' )
283276 assert rep == 'My message about md5'
284277
@@ -287,8 +280,8 @@ def test_report(self):
287280def temp_home (tmpdir , monkeypatch ):
288281 key = (
289282 'USERPROFILE'
290- if platform .system () == 'Windows' and sys .version_info > (3 , 8 ) else
291- 'HOME'
283+ if platform .system () == 'Windows' and sys .version_info > (3 , 8 )
284+ else 'HOME'
292285 )
293286
294287 monkeypatch .setitem (os .environ , key , str (tmpdir ))
@@ -298,12 +291,16 @@ def temp_home(tmpdir, monkeypatch):
298291class TestPyPIConfig :
299292 def test_percent_in_password (self , temp_home ):
300293 pypirc = temp_home / '.pypirc'
301- pypirc .write (DALS ("""
294+ pypirc .write (
295+ DALS (
296+ """
302297 [pypi]
303298 repository=https://pypi.org
304299 username=jaraco
305300 password=pity%
306- """ ))
301+ """
302+ )
303+ )
307304 cfg = setuptools .package_index .PyPIConfig ()
308305 cred = cfg .creds_by_repository ['https://pypi.org' ]
309306 assert cred .username == 'jaraco'
0 commit comments