mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00
Replace deprecated assertEquals with assertEqual
assertEquals is deprecated since Python 2.7 and 3.2.
(cherry picked from commit 62abfe38e8
)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
df0ac742f7
commit
2e2529bae8
3 changed files with 16 additions and 16 deletions
|
@ -74,7 +74,7 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||
libapparmor.free_record(swig_record)
|
||||
|
||||
expected = self.parse_output_file(outfile)
|
||||
self.assertEquals(expected, record,
|
||||
self.assertEqual(expected, record,
|
||||
"expected records did not match\n" +
|
||||
"expected = %s\nactual = %s" % (expected, record))
|
||||
|
||||
|
@ -90,7 +90,7 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||
line = l.rstrip('\n')
|
||||
count += 1
|
||||
if line == "START":
|
||||
self.assertEquals(count, 1,
|
||||
self.assertEqual(count, 1,
|
||||
"Unexpected output format in %s" % (outfile))
|
||||
continue
|
||||
else:
|
||||
|
|
|
@ -137,7 +137,7 @@ class AAParserCachingCommon(testlib.AATestTemplate):
|
|||
with open(features_path) as f:
|
||||
features = f.read()
|
||||
if expected:
|
||||
self.assertEquals(expected_output, features,
|
||||
self.assertEqual(expected_output, features,
|
||||
"features contents differ, expected:\n%s\nresult:\n%s" % (expected_output, features))
|
||||
else:
|
||||
self.assertNotEquals(expected_output, features,
|
||||
|
@ -269,7 +269,7 @@ class AAParserCachingTests(AAParserCachingCommon):
|
|||
if (int(major) < 3) or ((int(major) == 3) and (int(minor) <= 2)):
|
||||
self.assertAlmostEquals(time1, time2, places=5)
|
||||
else:
|
||||
self.assertEquals(time1, time2)
|
||||
self.assertEqual(time1, time2)
|
||||
|
||||
def _set_mtime(self, path, mtime):
|
||||
atime = os.stat(path).st_atime
|
||||
|
@ -370,7 +370,7 @@ class AAParserCachingTests(AAParserCachingCommon):
|
|||
# in cache_contents because of the difficulty coercing cache
|
||||
# file bytes into strings in python3
|
||||
self.assertNotEquals(orig_stat.st_size, stat.st_size, 'Expected cache file to be updated, size is not changed.')
|
||||
self.assertEquals(os.stat(self.profile).st_mtime, stat.st_mtime)
|
||||
self.assertEqual(os.stat(self.profile).st_mtime, stat.st_mtime)
|
||||
|
||||
def test_cache_writing_clears_all_files(self):
|
||||
'''test cache writing clears all cache files'''
|
||||
|
@ -388,7 +388,7 @@ class AAParserCachingTests(AAParserCachingCommon):
|
|||
self._set_mtime(self.abstraction, 0)
|
||||
self._set_mtime(self.profile, expected)
|
||||
self._generate_cache_file()
|
||||
self.assertEquals(expected, os.stat(self.cache_file).st_mtime)
|
||||
self.assertEqual(expected, os.stat(self.cache_file).st_mtime)
|
||||
|
||||
def test_abstraction_mtime_preserved(self):
|
||||
'''test abstraction mtime is preserved when it is newest'''
|
||||
|
@ -396,7 +396,7 @@ class AAParserCachingTests(AAParserCachingCommon):
|
|||
self._set_mtime(self.profile, 0)
|
||||
self._set_mtime(self.abstraction, expected)
|
||||
self._generate_cache_file()
|
||||
self.assertEquals(expected, os.stat(self.cache_file).st_mtime)
|
||||
self.assertEqual(expected, os.stat(self.cache_file).st_mtime)
|
||||
|
||||
def test_equal_mtimes_preserved(self):
|
||||
'''test equal profile and abstraction mtimes are preserved'''
|
||||
|
@ -404,7 +404,7 @@ class AAParserCachingTests(AAParserCachingCommon):
|
|||
self._set_mtime(self.profile, expected)
|
||||
self._set_mtime(self.abstraction, expected)
|
||||
self._generate_cache_file()
|
||||
self.assertEquals(expected, os.stat(self.cache_file).st_mtime)
|
||||
self.assertEqual(expected, os.stat(self.cache_file).st_mtime)
|
||||
|
||||
def test_profile_newer_skips_cache(self):
|
||||
'''test cache is skipped if profile is newer'''
|
||||
|
@ -420,9 +420,9 @@ class AAParserCachingTests(AAParserCachingCommon):
|
|||
self.run_cmd_check(cmd, expected_string='Replacement succeeded for')
|
||||
|
||||
stat = os.stat(self.cache_file)
|
||||
self.assertEquals(orig_stat.st_size, stat.st_size)
|
||||
self.assertEquals(orig_stat.st_ino, stat.st_ino)
|
||||
self.assertEquals(orig_stat.st_mtime, stat.st_mtime)
|
||||
self.assertEqual(orig_stat.st_size, stat.st_size)
|
||||
self.assertEqual(orig_stat.st_ino, stat.st_ino)
|
||||
self.assertEqual(orig_stat.st_mtime, stat.st_mtime)
|
||||
|
||||
def test_abstraction_newer_skips_cache(self):
|
||||
'''test cache is skipped if abstraction is newer'''
|
||||
|
@ -438,9 +438,9 @@ class AAParserCachingTests(AAParserCachingCommon):
|
|||
self.run_cmd_check(cmd, expected_string='Replacement succeeded for')
|
||||
|
||||
stat = os.stat(self.cache_file)
|
||||
self.assertEquals(orig_stat.st_size, stat.st_size)
|
||||
self.assertEquals(orig_stat.st_ino, stat.st_ino)
|
||||
self.assertEquals(orig_stat.st_mtime, stat.st_mtime)
|
||||
self.assertEqual(orig_stat.st_size, stat.st_size)
|
||||
self.assertEqual(orig_stat.st_ino, stat.st_ino)
|
||||
self.assertEqual(orig_stat.st_mtime, stat.st_mtime)
|
||||
|
||||
def test_profile_newer_rewrites_cache(self):
|
||||
'''test cache is rewritten if profile is newer'''
|
||||
|
|
|
@ -1674,7 +1674,7 @@ POLICYGROUPS_DIR="%s/templates"
|
|||
|
||||
# verify we get the same manifest back
|
||||
man_new = easyp.gen_manifest(params)
|
||||
self.assertEquals(m, man_new)
|
||||
self.assertEqual(m, man_new)
|
||||
|
||||
def test_gen_manifest_ubuntu(self):
|
||||
'''Test gen_manifest (ubuntu)'''
|
||||
|
@ -1714,7 +1714,7 @@ POLICYGROUPS_DIR="%s/templates"
|
|||
|
||||
# verify we get the same manifest back
|
||||
man_new = easyp.gen_manifest(params)
|
||||
self.assertEquals(m, man_new)
|
||||
self.assertEqual(m, man_new)
|
||||
|
||||
def test_parse_manifest_no_version(self):
|
||||
'''Test parse_manifest (vendor with no version)'''
|
||||
|
|
Loading…
Add table
Reference in a new issue