pep8 fix: assertEquals -> assertEqual
assertEquals is deprecated in py3, fixing in: dir: test/unit/cli/* Change-Id: I9a2fc1f717beafd5fa8408942046e310e8de0318
This commit is contained in:
parent
5b24b22498
commit
f449e91472
@ -128,8 +128,8 @@ Metadata:
|
||||
No system metadata found in db file
|
||||
User Metadata: {'mydata': 'swift'}'''
|
||||
|
||||
self.assertEquals(sorted(out.getvalue().strip().split('\n')),
|
||||
sorted(exp_out.split('\n')))
|
||||
self.assertEqual(sorted(out.getvalue().strip().split('\n')),
|
||||
sorted(exp_out.split('\n')))
|
||||
|
||||
info = dict(
|
||||
account='acct',
|
||||
@ -175,8 +175,8 @@ Metadata:
|
||||
X-Container-Foo: bar
|
||||
System Metadata: {'mydata': 'swift'}
|
||||
No user metadata found in db file''' % POLICIES[0].name
|
||||
self.assertEquals(sorted(out.getvalue().strip().split('\n')),
|
||||
sorted(exp_out.split('\n')))
|
||||
self.assertEqual(sorted(out.getvalue().strip().split('\n')),
|
||||
sorted(exp_out.split('\n')))
|
||||
|
||||
def test_print_ring_locations_invalid_args(self):
|
||||
self.assertRaises(ValueError, print_ring_locations,
|
||||
@ -306,7 +306,7 @@ No user metadata found in db file''' % POLICIES[0].name
|
||||
if exp_raised:
|
||||
exp_out = 'Does not appear to be a DB of type "account":' \
|
||||
' ./d49d0ecbb53be1fcc49624f2f7c7ccae.db'
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
else:
|
||||
self.fail("Expected an InfoSystemExit exception to be raised")
|
||||
|
||||
@ -334,8 +334,8 @@ class TestPrintObj(TestCliInfoBase):
|
||||
out = StringIO()
|
||||
with mock.patch('sys.stdout', out):
|
||||
self.assertRaises(InfoSystemExit, print_obj, datafile)
|
||||
self.assertEquals(out.getvalue().strip(),
|
||||
'Invalid metadata')
|
||||
self.assertEqual(out.getvalue().strip(),
|
||||
'Invalid metadata')
|
||||
|
||||
def test_print_obj_valid(self):
|
||||
out = StringIO()
|
||||
@ -489,7 +489,7 @@ Other Metadata:
|
||||
No metadata found''' % (
|
||||
utils.Timestamp(106.3).internal)
|
||||
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
|
||||
metadata = get_metadata({
|
||||
'X-Object-Sysmeta-Mtime': '107.3',
|
||||
@ -514,7 +514,7 @@ Other Metadata:
|
||||
No metadata found''' % (
|
||||
utils.Timestamp(106.3).internal)
|
||||
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
|
||||
metadata = get_metadata({
|
||||
'X-Object-Meta-Mtime': '107.3',
|
||||
@ -539,7 +539,7 @@ Other Metadata:
|
||||
X-Object-Mtime: 107.3''' % (
|
||||
utils.Timestamp(106.3).internal)
|
||||
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
|
||||
metadata = get_metadata({})
|
||||
out = StringIO()
|
||||
@ -560,7 +560,7 @@ Other Metadata:
|
||||
No metadata found''' % (
|
||||
utils.Timestamp(106.3).internal)
|
||||
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
|
||||
metadata = get_metadata({'X-Object-Meta-Mtime': '107.3'})
|
||||
metadata['name'] = '/a-s'
|
||||
@ -583,7 +583,7 @@ Other Metadata:
|
||||
No metadata found''' % (
|
||||
utils.Timestamp(106.3).internal)
|
||||
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
|
||||
metadata = get_metadata({'X-Object-Meta-Mtime': '107.3'})
|
||||
del metadata['Content-Type']
|
||||
@ -605,7 +605,7 @@ Other Metadata:
|
||||
No metadata found''' % (
|
||||
utils.Timestamp(106.3).internal)
|
||||
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
|
||||
metadata = get_metadata({'X-Object-Meta-Mtime': '107.3'})
|
||||
del metadata['X-Timestamp']
|
||||
@ -626,7 +626,7 @@ User Metadata:
|
||||
Other Metadata:
|
||||
No metadata found'''
|
||||
|
||||
self.assertEquals(out.getvalue().strip(), exp_out)
|
||||
self.assertEqual(out.getvalue().strip(), exp_out)
|
||||
|
||||
|
||||
class TestPrintObjWeirdPath(TestPrintObjFullMeta):
|
||||
|
@ -290,10 +290,10 @@ class TestRecon(unittest.TestCase):
|
||||
m = r.match(line)
|
||||
if m:
|
||||
ex = expected.pop(m.group(1))
|
||||
self.assertEquals(m.group(2),
|
||||
" low: %s, high: %s, avg: %s, total: %s,"
|
||||
" Failed: %s%%, no_result: %s, reported: %s"
|
||||
% ex)
|
||||
self.assertEqual(m.group(2),
|
||||
" low: %s, high: %s, avg: %s, total: %s,"
|
||||
" Failed: %s%%, no_result: %s, reported: %s"
|
||||
% ex)
|
||||
self.assertFalse(expected)
|
||||
|
||||
def test_drive_audit_check(self):
|
||||
@ -328,10 +328,10 @@ class TestRecon(unittest.TestCase):
|
||||
for line in lines:
|
||||
m = r.match(line)
|
||||
if m:
|
||||
self.assertEquals(m.group(2),
|
||||
" low: %s, high: %s, avg: %s, total: %s,"
|
||||
" Failed: %s%%, no_result: %s, reported: %s"
|
||||
% expected)
|
||||
self.assertEqual(m.group(2),
|
||||
" low: %s, high: %s, avg: %s, total: %s,"
|
||||
" Failed: %s%%, no_result: %s, reported: %s"
|
||||
% expected)
|
||||
|
||||
|
||||
class TestReconCommands(unittest.TestCase):
|
||||
|
@ -147,7 +147,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._parse_search_values(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_find_parts(self):
|
||||
rb = RingBuilder(8, 3, 0)
|
||||
@ -185,7 +185,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._parse_list_parts_values(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_parse_add_values_number_of_arguments(self):
|
||||
# Test Number of arguments abnormal
|
||||
@ -195,7 +195,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._parse_add_values(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_weight_values_no_devices(self):
|
||||
# Test no devices
|
||||
@ -204,7 +204,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._set_weight_values([], 100)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_parse_set_weight_values_number_of_arguments(self):
|
||||
# Test Number of arguments abnormal
|
||||
@ -214,7 +214,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._parse_set_weight_values(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
argv = ["--region", "2"]
|
||||
err = None
|
||||
@ -222,7 +222,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._parse_set_weight_values(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_info_values_no_devices(self):
|
||||
# Test no devices
|
||||
@ -231,7 +231,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._set_info_values([], 100)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_parse_set_info_values_number_of_arguments(self):
|
||||
# Test Number of arguments abnormal
|
||||
@ -241,7 +241,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._parse_set_info_values(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_parse_remove_values_number_of_arguments(self):
|
||||
# Test Number of arguments abnormal
|
||||
@ -251,7 +251,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder._parse_remove_values(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_create_ring(self):
|
||||
argv = ["", self.tmpfile, "create", "6", "3.14159265359", "1"]
|
||||
@ -405,7 +405,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_add_device_already_exists(self):
|
||||
# Test Add a device that already exists
|
||||
@ -416,7 +416,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_remove_device(self):
|
||||
for search_value in self.search_values:
|
||||
@ -692,7 +692,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_remove_device_no_matching(self):
|
||||
self.create_sample_ring()
|
||||
@ -704,7 +704,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_weight(self):
|
||||
for search_value in self.search_values:
|
||||
@ -903,7 +903,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_weight_no_matching(self):
|
||||
self.create_sample_ring()
|
||||
@ -915,7 +915,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_info(self):
|
||||
for search_value in self.search_values:
|
||||
@ -1195,7 +1195,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_info_no_matching(self):
|
||||
self.create_sample_ring()
|
||||
@ -1207,7 +1207,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_info_already_exists(self):
|
||||
self.create_sample_ring()
|
||||
@ -1230,7 +1230,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_min_part_hours(self):
|
||||
self.create_sample_ring()
|
||||
@ -1247,7 +1247,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_replicas(self):
|
||||
self.create_sample_ring()
|
||||
@ -1321,7 +1321,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_set_replicas_invalid_value(self):
|
||||
# Test not a valid number
|
||||
@ -1331,7 +1331,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
# Test new replicas is 0
|
||||
argv = ["", self.tmpfile, "set_replicas", "0"]
|
||||
@ -1340,7 +1340,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_validate(self):
|
||||
self.create_sample_ring()
|
||||
@ -1358,7 +1358,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_validate_corrupted_file(self):
|
||||
self.create_sample_ring()
|
||||
@ -1376,7 +1376,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_validate_non_existent_file(self):
|
||||
rand_file = '%s/%s' % ('/tmp', str(uuid.uuid4()))
|
||||
@ -1386,7 +1386,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_validate_non_accessible_file(self):
|
||||
with mock.patch.object(
|
||||
@ -1398,7 +1398,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_validate_generic_error(self):
|
||||
with mock.patch.object(
|
||||
@ -1410,7 +1410,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_search_device_ipv4_old_format(self):
|
||||
self.create_sample_ring()
|
||||
@ -1510,7 +1510,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_search_device_no_matching(self):
|
||||
self.create_sample_ring()
|
||||
@ -1522,7 +1522,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_list_parts_ipv4_old_format(self):
|
||||
self.create_sample_ring()
|
||||
@ -1622,7 +1622,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_list_parts_no_matching(self):
|
||||
self.create_sample_ring()
|
||||
@ -1634,7 +1634,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_unknown(self):
|
||||
argv = ["", self.tmpfile, "unknown"]
|
||||
@ -1643,7 +1643,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_default(self):
|
||||
self.create_sample_ring()
|
||||
@ -1669,7 +1669,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 1)
|
||||
self.assertEqual(err.code, 1)
|
||||
|
||||
def test_rebalance_no_devices(self):
|
||||
# Test no devices
|
||||
@ -1681,7 +1681,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_write_ring(self):
|
||||
self.create_sample_ring()
|
||||
@ -1702,7 +1702,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_warn_at_risk(self):
|
||||
self.create_sample_ring()
|
||||
@ -1715,7 +1715,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as e:
|
||||
err = e
|
||||
self.assertEquals(err.code, 1)
|
||||
self.assertEqual(err.code, 1)
|
||||
|
||||
def test_invalid_device_name(self):
|
||||
self.create_sample_ring()
|
||||
@ -1731,7 +1731,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as exc:
|
||||
err = exc
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
argv = ["",
|
||||
self.tmpfile,
|
||||
@ -1746,7 +1746,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
ringbuilder.main(argv)
|
||||
except SystemExit as exc:
|
||||
err = exc
|
||||
self.assertEquals(err.code, 2)
|
||||
self.assertEqual(err.code, 2)
|
||||
|
||||
def test_dispersion_command(self):
|
||||
self.create_sample_ring()
|
||||
|
Loading…
Reference in New Issue
Block a user