From f28c07fa23d6155150ea3acc2c61573f39bc0156 Mon Sep 17 00:00:00 2001 From: Dominik Rumian Date: Aug 24 2021 12:15:54 +0000 Subject: [PATCH] Use 'six' library in tests Signed-off-by: Dominik Rumian --- diff --git a/tests/test_cli.py b/tests/test_cli.py index 735f4d7..887917c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1534,8 +1534,8 @@ class TestImportSrpm(LookasideCacheMock, CliTestCase): # Exception is not a functionality issue. There is no problem with # uploading same file twice in a test however, the upload method checks # if file has been already uploaded. - self.assertRaisesRegex(AlreadyUploadedError, r'File already uploaded', - self.assert_import_srpm, self.cloned_repo_path) + six.assertRaisesRegex(self, AlreadyUploadedError, r'File already uploaded', + self.assert_import_srpm, self.cloned_repo_path) def test_import_gating_and_rpmlintrc_exception(self): # Add three additional files to the repo. Former gating.yaml and package.rpmlintrc are diff --git a/tests/test_lookaside.py b/tests/test_lookaside.py index 6946b79..f36a222 100644 --- a/tests/test_lookaside.py +++ b/tests/test_lookaside.py @@ -15,6 +15,8 @@ import unittest import mock import pycurl +import six + from pyrpkg.errors import (AlreadyUploadedError, DownloadError, InvalidHashType, UploadError) from pyrpkg.lookaside import CGILookasideCache @@ -512,8 +514,8 @@ class CGILookasideCacheTestCase(unittest.TestCase): with mock.patch.object(lc, 'remote_file_exists', lambda *x: True): # self.assertRaises(AlreadyUploadedError, lc.upload, 'pyrpkg', # 'pyrpkg-0.tar.xz', hash) - self.assertRaisesRegex(AlreadyUploadedError, r'File already uploaded', - lc.upload, 'pyrpkg', 'pyrpkg-0.tar.xz', hash) + six.assertRaisesRegex(self, AlreadyUploadedError, r'File already uploaded', + lc.upload, 'pyrpkg', 'pyrpkg-0.tar.xz', hash) self.assertEqual(curl.perform.call_count, 0) self.assertEqual(curl.setopt.call_count, 0)