@@ -64,7 +64,7 @@ class RepoTestMixin(object):
6464
6565 @classmethod
6666 def setUpClass (cls ):
67- cls .TMP_CACHEDIR = tempfile .mkdtemp (prefix = " dnf-repotest-" )
67+ cls .TMP_CACHEDIR = tempfile .mkdtemp (prefix = ' dnf-repotest-' )
6868
6969 @classmethod
7070 def tearDownClass (cls ):
@@ -97,11 +97,11 @@ def setUp(self):
9797 result .yum_repo = {'primary' : support .NONEXISTENT_FILE }
9898 handle = mock .Mock (spec = ['mirrors' ])
9999 handle .mirrors = []
100- self .md = dnf .repo .Metadata (result , handle )
100+ self .metadata = dnf .repo .Metadata (result , handle )
101101
102102 def test_file_timestamp (self ):
103103 self .assertRaises (dnf .exceptions .MetadataError ,
104- self .md .file_timestamp , 'primary' )
104+ self .metadata .file_timestamp , 'primary' )
105105
106106class RepoTest (RepoTestMixin , support .TestCase ):
107107 """Test the logic of dnf.repo.Repo.
@@ -237,11 +237,11 @@ def test_progress_cb(self):
237237 def test_repo_gpgcheck (self , setopt ):
238238 """Test repo_gpgcheck option works."""
239239 self .repo .repo_gpgcheck = False
240- handle = self .repo ._handle_new_remote (" /bag" )
240+ self .repo ._handle_new_remote (' /bag' )
241241 setopt .assert_any_call (librepo .LRO_GPGCHECK , False )
242242
243243 self .repo .repo_gpgcheck = True
244- handle = self .repo ._handle_new_remote (" /bag" )
244+ self .repo ._handle_new_remote (' /bag' )
245245 setopt .assert_any_call (librepo .LRO_GPGCHECK , True )
246246
247247 def test_reset_metadata_expired (self ):
@@ -310,7 +310,7 @@ def test_reviving(self, new_remote_m, reset_age_m):
310310
311311 @mock .patch .object (dnf .repo .Metadata , 'reset_age' )
312312 @mock .patch ('dnf.repo.Repo._handle_new_remote' )
313- def test_reviving_lame_hashes (self , new_remote_m , reset_age_m ):
313+ def test_reviving_lame_hashes (self , new_remote_m , _ ):
314314 self .repo .md_expire_cache ()
315315 self .repo .metalink = 'http://meh'
316316 new_remote_m ().metalink = \
@@ -321,7 +321,7 @@ def test_reviving_lame_hashes(self, new_remote_m, reset_age_m):
321321
322322 @mock .patch .object (dnf .repo .Metadata , 'reset_age' )
323323 @mock .patch ('dnf.repo.Repo._handle_new_remote' )
324- def test_reviving_mismatched_hashes (self , new_remote_m , reset_age_m ):
324+ def test_reviving_mismatched_hashes (self , new_remote_m , _ ):
325325 self .repo .md_expire_cache ()
326326 self .repo .metalink = 'http://meh'
327327 new_remote_m ().metalink = \
@@ -334,12 +334,15 @@ def test_reviving_mismatched_hashes(self, new_remote_m, reset_age_m):
334334
335335 @mock .patch ('dnf.repo.Repo._handle_new_remote' )
336336 def test_reviving_404 (self , new_remote_m ):
337+ url = 'http://meh'
337338 self .repo .md_expire_cache ()
338- self .repo .metalink = 'http://meh'
339- exc = librepo .LibrepoException (10 , 'Error HTTP/FTP status code: 404' , 404 )
339+ self .repo .metalink = url
340+ exc = dnf .repo ._DetailedLibrepoError ('Error HTTP/FTP status code: 404' ,
341+ url )
340342 new_remote_m ().perform = mock .Mock (side_effect = exc )
341343 self .assertRaises (dnf .exceptions .RepoError , self .repo .load )
342344
345+
343346class DownloadPayloadsTest (RepoTestMixin , support .TestCase ):
344347
345348 def test_drpm_error (self ):
@@ -359,7 +362,7 @@ def test_empty_transaction(self):
359362 self .assertEmpty (errs .irrecoverable )
360363
361364 def test_fatal_error (self ):
362- def raiser (targets , failfast ):
365+ def raiser (_ , failfast ):
363366 raise librepo .LibrepoException (10 , 'hit' , 'before' )
364367
365368 drpm = dnf .drpm .DeltaInfo (None , None )
0 commit comments