tests: Stop using deprecated assertEquals
The recommended way is assertEqual
This commit is contained in:
parent
ebd2f1dcee
commit
fcebefd3bb
|
@ -39,7 +39,7 @@ class TestCapabilities(unittest.TestCase):
|
|||
|
||||
caps = self._buildCaps(filename)
|
||||
for f in host_feature_list:
|
||||
self.assertEquals(caps.host.cpu.has_feature(f), True)
|
||||
self.assertEqual(caps.host.cpu.has_feature(f), True)
|
||||
|
||||
def testCapsCPUFeaturesOldSyntaxSVM(self):
|
||||
filename = "test-old-svm.xml"
|
||||
|
@ -47,7 +47,7 @@ class TestCapabilities(unittest.TestCase):
|
|||
|
||||
caps = self._buildCaps(filename)
|
||||
for f in host_feature_list:
|
||||
self.assertEquals(caps.host.cpu.has_feature(f), True)
|
||||
self.assertEqual(caps.host.cpu.has_feature(f), True)
|
||||
|
||||
def testCapsCPUFeaturesNewSyntax(self):
|
||||
filename = "test-qemu-with-kvm.xml"
|
||||
|
@ -56,13 +56,13 @@ class TestCapabilities(unittest.TestCase):
|
|||
|
||||
caps = self._buildCaps(filename)
|
||||
for f in host_feature_list:
|
||||
self.assertEquals(caps.host.cpu.has_feature(f), True)
|
||||
self.assertEqual(caps.host.cpu.has_feature(f), True)
|
||||
|
||||
self.assertEquals(caps.host.cpu.model, "core2duo")
|
||||
self.assertEquals(caps.host.cpu.vendor, "Intel")
|
||||
self.assertEquals(caps.host.cpu.threads, 3)
|
||||
self.assertEquals(caps.host.cpu.cores, 5)
|
||||
self.assertEquals(caps.host.cpu.sockets, 7)
|
||||
self.assertEqual(caps.host.cpu.model, "core2duo")
|
||||
self.assertEqual(caps.host.cpu.vendor, "Intel")
|
||||
self.assertEqual(caps.host.cpu.threads, 3)
|
||||
self.assertEqual(caps.host.cpu.cores, 5)
|
||||
self.assertEqual(caps.host.cpu.sockets, 7)
|
||||
|
||||
def testCapsUtilFuncs(self):
|
||||
caps_with_kvm = self._buildCaps("test-qemu-with-kvm.xml")
|
||||
|
@ -71,8 +71,8 @@ class TestCapabilities(unittest.TestCase):
|
|||
|
||||
def test_utils(caps, has_guests, is_kvm):
|
||||
if caps.guests:
|
||||
self.assertEquals(caps.guests[0].has_install_options(), has_guests)
|
||||
self.assertEquals(caps.guests[0].is_kvm_available(), is_kvm)
|
||||
self.assertEqual(caps.guests[0].has_install_options(), has_guests)
|
||||
self.assertEqual(caps.guests[0].is_kvm_available(), is_kvm)
|
||||
|
||||
test_utils(caps_empty, False, False)
|
||||
test_utils(caps_with_kvm, True, True)
|
||||
|
@ -80,9 +80,9 @@ class TestCapabilities(unittest.TestCase):
|
|||
|
||||
def testCapsNuma(self):
|
||||
cells = self._buildCaps("lxc.xml").host.topology.cells
|
||||
self.assertEquals(len(cells), 1)
|
||||
self.assertEquals(len(cells[0].cpus), 8)
|
||||
self.assertEquals(cells[0].cpus[3].id, '3')
|
||||
self.assertEqual(len(cells), 1)
|
||||
self.assertEqual(len(cells[0].cpus), 8)
|
||||
self.assertEqual(cells[0].cpus[3].id, '3')
|
||||
|
||||
|
||||
################################################
|
||||
|
@ -106,7 +106,7 @@ class TestCapabilities(unittest.TestCase):
|
|||
for c in cpus:
|
||||
self.assertTrue(c in cpunames)
|
||||
|
||||
self.assertEquals(cpu_64, cpu_32)
|
||||
self.assertEqual(cpu_64, cpu_32)
|
||||
|
||||
x86_cpunames = [
|
||||
'486', 'athlon', 'Conroe', 'core2duo', 'coreduo', 'n270',
|
||||
|
@ -136,10 +136,10 @@ class TestCapabilities(unittest.TestCase):
|
|||
caps = DomainCapabilities(utils.open_testdriver(), xml)
|
||||
|
||||
self.assertEqual(caps.os.loader.supported, True)
|
||||
self.assertEquals(caps.os.loader.get_values(),
|
||||
self.assertEqual(caps.os.loader.get_values(),
|
||||
["/foo/bar", "/tmp/my_path"])
|
||||
self.assertEquals(caps.os.loader.enum_names(), ["type", "readonly"])
|
||||
self.assertEquals(caps.os.loader.get_enum("type").get_values(),
|
||||
self.assertEqual(caps.os.loader.enum_names(), ["type", "readonly"])
|
||||
self.assertEqual(caps.os.loader.get_enum("type").get_values(),
|
||||
["rom", "pflash"])
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class CheckPropsTest(unittest.TestCase):
|
|||
fail = [p for p in virtinst.xmlbuilder._allprops
|
||||
if p not in virtinst.xmlbuilder._seenprops]
|
||||
try:
|
||||
self.assertEquals([], fail)
|
||||
self.assertEqual([], fail)
|
||||
except AssertionError:
|
||||
msg = "".join(traceback.format_exc()) + "\n\n"
|
||||
msg += ("This means that there are XML properties that are\n"
|
||||
|
|
|
@ -32,7 +32,7 @@ class VMMCLI(unittest.TestCase):
|
|||
|
||||
win = uiutils.find_pattern(self.app.root,
|
||||
"test testdriver.xml Connection Details", "frame")
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
uiutils.find_fuzzy(win, None, "text", "Name:").text,
|
||||
"test testdriver.xml")
|
||||
self.app.quit()
|
||||
|
|
|
@ -92,7 +92,7 @@ class NewVM(unittest.TestCase):
|
|||
time.sleep(1)
|
||||
|
||||
self.assertFalse(browser.showing)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
uiutils.find_fuzzy(newvm, "os-version-label", "label").text,
|
||||
"Unknown")
|
||||
|
||||
|
@ -100,7 +100,7 @@ class NewVM(unittest.TestCase):
|
|||
uiutils.find_fuzzy(newvm, "Automatically detect", "check").click()
|
||||
version = uiutils.find_fuzzy(newvm,
|
||||
"install-os-version-entry", "text")
|
||||
self.assertEquals(version.text, "Generic")
|
||||
self.assertEqual(version.text, "Generic")
|
||||
|
||||
ostype = uiutils.find_fuzzy(newvm, "install-os-type", "combo")
|
||||
ostype.click()
|
||||
|
@ -155,7 +155,7 @@ class NewVM(unittest.TestCase):
|
|||
version = uiutils.find_pattern(newvm, "install-os-version-label")
|
||||
time.sleep(1)
|
||||
uiutils.check_in_loop(lambda: "Detecting" not in version.text)
|
||||
self.assertEquals(version.text, "Red Hat Enterprise Linux 5.5")
|
||||
self.assertEqual(version.text, "Red Hat Enterprise Linux 5.5")
|
||||
|
||||
uiutils.find_fuzzy(newvm, "Forward", "button").click()
|
||||
uiutils.find_fuzzy(newvm, "Forward", "button").click()
|
||||
|
|
|
@ -29,16 +29,16 @@ class TestURI(unittest.TestCase):
|
|||
hostname='', query='', fragment='',
|
||||
is_ipv6=False, host_is_ipv4_string=False):
|
||||
uriinfo = URI(uri)
|
||||
self.assertEquals(scheme, uriinfo.scheme)
|
||||
self.assertEquals(transport, uriinfo.transport)
|
||||
self.assertEquals(port, uriinfo.port)
|
||||
self.assertEquals(username, uriinfo.username)
|
||||
self.assertEquals(path, uriinfo.path)
|
||||
self.assertEquals(hostname, uriinfo.hostname)
|
||||
self.assertEquals(query, uriinfo.query)
|
||||
self.assertEquals(fragment, uriinfo.fragment)
|
||||
self.assertEquals(is_ipv6, uriinfo.is_ipv6)
|
||||
self.assertEquals(host_is_ipv4_string, uriinfo.host_is_ipv4_string)
|
||||
self.assertEqual(scheme, uriinfo.scheme)
|
||||
self.assertEqual(transport, uriinfo.transport)
|
||||
self.assertEqual(port, uriinfo.port)
|
||||
self.assertEqual(username, uriinfo.username)
|
||||
self.assertEqual(path, uriinfo.path)
|
||||
self.assertEqual(hostname, uriinfo.hostname)
|
||||
self.assertEqual(query, uriinfo.query)
|
||||
self.assertEqual(fragment, uriinfo.fragment)
|
||||
self.assertEqual(is_ipv6, uriinfo.is_ipv6)
|
||||
self.assertEqual(host_is_ipv4_string, uriinfo.host_is_ipv4_string)
|
||||
|
||||
def testURIs(self):
|
||||
self._compare("lxc://", scheme="lxc")
|
||||
|
|
|
@ -175,12 +175,12 @@ class TestXMLMisc(unittest.TestCase):
|
|||
|
||||
expect = base[:]
|
||||
expect[1] = expect[2] = expect[3] = True
|
||||
self.assertEquals(tuple(expect),
|
||||
self.assertEqual(tuple(expect),
|
||||
virtinst.DomainNumatune.cpuset_str_to_tuple(conn, "1-3"))
|
||||
|
||||
expect = base[:]
|
||||
expect[1] = expect[3] = expect[5] = expect[10] = expect[11] = True
|
||||
self.assertEquals(tuple(expect),
|
||||
self.assertEqual(tuple(expect),
|
||||
virtinst.DomainNumatune.cpuset_str_to_tuple(conn, "1,3,5,10-11"))
|
||||
|
||||
self.assertRaises(ValueError,
|
||||
|
@ -189,40 +189,40 @@ class TestXMLMisc(unittest.TestCase):
|
|||
|
||||
def testDiskNumbers(self):
|
||||
# Various testing our target generation
|
||||
self.assertEquals("a", VirtualDisk.num_to_target(1))
|
||||
self.assertEquals("b", VirtualDisk.num_to_target(2))
|
||||
self.assertEquals("z", VirtualDisk.num_to_target(26))
|
||||
self.assertEquals("aa", VirtualDisk.num_to_target(27))
|
||||
self.assertEquals("ab", VirtualDisk.num_to_target(28))
|
||||
self.assertEquals("az", VirtualDisk.num_to_target(52))
|
||||
self.assertEquals("ba", VirtualDisk.num_to_target(53))
|
||||
self.assertEquals("zz", VirtualDisk.num_to_target(27 * 26))
|
||||
self.assertEquals("aaa", VirtualDisk.num_to_target(27 * 26 + 1))
|
||||
self.assertEqual("a", VirtualDisk.num_to_target(1))
|
||||
self.assertEqual("b", VirtualDisk.num_to_target(2))
|
||||
self.assertEqual("z", VirtualDisk.num_to_target(26))
|
||||
self.assertEqual("aa", VirtualDisk.num_to_target(27))
|
||||
self.assertEqual("ab", VirtualDisk.num_to_target(28))
|
||||
self.assertEqual("az", VirtualDisk.num_to_target(52))
|
||||
self.assertEqual("ba", VirtualDisk.num_to_target(53))
|
||||
self.assertEqual("zz", VirtualDisk.num_to_target(27 * 26))
|
||||
self.assertEqual("aaa", VirtualDisk.num_to_target(27 * 26 + 1))
|
||||
|
||||
self.assertEquals(VirtualDisk.target_to_num("hda"), 0)
|
||||
self.assertEquals(VirtualDisk.target_to_num("hdb"), 1)
|
||||
self.assertEquals(VirtualDisk.target_to_num("sdz"), 25)
|
||||
self.assertEquals(VirtualDisk.target_to_num("sdaa"), 26)
|
||||
self.assertEquals(VirtualDisk.target_to_num("vdab"), 27)
|
||||
self.assertEquals(VirtualDisk.target_to_num("vdaz"), 51)
|
||||
self.assertEquals(VirtualDisk.target_to_num("xvdba"), 52)
|
||||
self.assertEquals(VirtualDisk.target_to_num("xvdzz"),
|
||||
self.assertEqual(VirtualDisk.target_to_num("hda"), 0)
|
||||
self.assertEqual(VirtualDisk.target_to_num("hdb"), 1)
|
||||
self.assertEqual(VirtualDisk.target_to_num("sdz"), 25)
|
||||
self.assertEqual(VirtualDisk.target_to_num("sdaa"), 26)
|
||||
self.assertEqual(VirtualDisk.target_to_num("vdab"), 27)
|
||||
self.assertEqual(VirtualDisk.target_to_num("vdaz"), 51)
|
||||
self.assertEqual(VirtualDisk.target_to_num("xvdba"), 52)
|
||||
self.assertEqual(VirtualDisk.target_to_num("xvdzz"),
|
||||
26 * (25 + 1) + 25)
|
||||
self.assertEquals(VirtualDisk.target_to_num("xvdaaa"),
|
||||
self.assertEqual(VirtualDisk.target_to_num("xvdaaa"),
|
||||
26 * 26 * 1 + 26 * 1 + 0)
|
||||
|
||||
disk = virtinst.VirtualDisk(_default_conn)
|
||||
disk.bus = "ide"
|
||||
|
||||
self.assertEquals("hda", disk.generate_target([]))
|
||||
self.assertEquals("hdb", disk.generate_target(["hda"]))
|
||||
self.assertEquals("hdc", disk.generate_target(["hdb", "sda"]))
|
||||
self.assertEquals("hdb", disk.generate_target(["hda", "hdd"]))
|
||||
self.assertEqual("hda", disk.generate_target([]))
|
||||
self.assertEqual("hdb", disk.generate_target(["hda"]))
|
||||
self.assertEqual("hdc", disk.generate_target(["hdb", "sda"]))
|
||||
self.assertEqual("hdb", disk.generate_target(["hda", "hdd"]))
|
||||
|
||||
disk.bus = "virtio-scsi"
|
||||
self.assertEquals("sdb",
|
||||
self.assertEqual("sdb",
|
||||
disk.generate_target(["sda", "sdg", "sdi"], 0))
|
||||
self.assertEquals("sdh", disk.generate_target(["sda", "sdg"], 1))
|
||||
self.assertEqual("sdh", disk.generate_target(["sda", "sdg"], 1))
|
||||
|
||||
def testQuickTreeinfo(self):
|
||||
# Simple sanity test to make sure detect_distro works. test-urls
|
||||
|
@ -231,38 +231,38 @@ class TestXMLMisc(unittest.TestCase):
|
|||
location="tests/cli-test-xml/fakefedoratree")
|
||||
g = _make_guest(i)
|
||||
v = i.detect_distro(g)
|
||||
self.assertEquals(v, "fedora17")
|
||||
self.assertEqual(v, "fedora17")
|
||||
|
||||
i = _make_installer(
|
||||
location="tests/cli-test-xml/fakerhel6tree")
|
||||
g = _make_guest(i)
|
||||
v = i.detect_distro(g)
|
||||
self.assertEquals(v, "rhel6.0")
|
||||
self.assertEqual(v, "rhel6.0")
|
||||
|
||||
def testCPUTopology(self):
|
||||
# Test CPU topology determining
|
||||
cpu = virtinst.CPU(_default_conn)
|
||||
cpu.sockets = "2"
|
||||
cpu.set_topology_defaults(6)
|
||||
self.assertEquals([cpu.sockets, cpu.cores, cpu.threads], [2, 3, 1])
|
||||
self.assertEqual([cpu.sockets, cpu.cores, cpu.threads], [2, 3, 1])
|
||||
|
||||
cpu = virtinst.CPU(_default_conn)
|
||||
cpu.cores = "4"
|
||||
cpu.set_topology_defaults(9)
|
||||
self.assertEquals([cpu.sockets, cpu.cores, cpu.threads], [2, 4, 1])
|
||||
self.assertEqual([cpu.sockets, cpu.cores, cpu.threads], [2, 4, 1])
|
||||
|
||||
cpu = virtinst.CPU(_default_conn)
|
||||
cpu.threads = "3"
|
||||
cpu.set_topology_defaults(14)
|
||||
self.assertEquals([cpu.sockets, cpu.cores, cpu.threads], [4, 1, 3])
|
||||
self.assertEqual([cpu.sockets, cpu.cores, cpu.threads], [4, 1, 3])
|
||||
|
||||
cpu = virtinst.CPU(_default_conn)
|
||||
cpu.sockets = 5
|
||||
cpu.cores = 2
|
||||
self.assertEquals(cpu.vcpus_from_topology(), 10)
|
||||
self.assertEqual(cpu.vcpus_from_topology(), 10)
|
||||
|
||||
cpu = virtinst.CPU(_default_conn)
|
||||
self.assertEquals(cpu.vcpus_from_topology(), 1)
|
||||
self.assertEqual(cpu.vcpus_from_topology(), 1)
|
||||
|
||||
def testAC97(self):
|
||||
# Test setting ac97 version given various version combos
|
||||
|
|
|
@ -72,12 +72,12 @@ class XMLParseTest(unittest.TestCase):
|
|||
set newval, and make sure it is returned properly
|
||||
"""
|
||||
curval = getattr(obj, param)
|
||||
self.assertEquals(initval, curval)
|
||||
self.assertEqual(initval, curval)
|
||||
|
||||
for newval in args:
|
||||
setattr(obj, param, newval)
|
||||
curval = getattr(obj, param)
|
||||
self.assertEquals(newval, curval)
|
||||
self.assertEqual(newval, curval)
|
||||
|
||||
def _make_checker(self, obj):
|
||||
def check(name, initval, *args):
|
||||
|
@ -181,7 +181,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
check("policy", "force", "disable")
|
||||
rmfeat = guest.cpu.features[3]
|
||||
guest.cpu.remove_feature(rmfeat)
|
||||
self.assertEquals(rmfeat.get_xml_config(),
|
||||
self.assertEqual(rmfeat.get_xml_config(),
|
||||
"""<feature name="foo" policy="bar"/>\n""")
|
||||
guest.cpu.add_feature("addfeature")
|
||||
|
||||
|
@ -423,7 +423,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
"""<target dev="hda" bus="ide"/></disk>\n""")
|
||||
d = virtinst.VirtualDisk(conn, parsexml=xml)
|
||||
self._set_and_check(d, "target", "hda", "hdb")
|
||||
self.assertEquals(xml.replace("hda", "hdb"), d.get_xml_config())
|
||||
self.assertEqual(xml.replace("hda", "hdb"), d.get_xml_config())
|
||||
|
||||
def testAlterChars(self):
|
||||
guest, outfile = self._get_test_content("change-chars")
|
||||
|
@ -1035,8 +1035,8 @@ class XMLParseTest(unittest.TestCase):
|
|||
outfile = "tests/xmlparse-xml/interface-%s-out.xml" % basename
|
||||
iface = virtinst.Interface(conn, parsexml=file(infile).read())
|
||||
|
||||
self.assertEquals(len(iface.protocols), 2)
|
||||
self.assertEquals(len(iface.interfaces), 3)
|
||||
self.assertEqual(len(iface.protocols), 2)
|
||||
self.assertEqual(len(iface.interfaces), 3)
|
||||
|
||||
check = self._make_checker(iface)
|
||||
check("type", "bridge", "foo", "bridge")
|
||||
|
@ -1048,7 +1048,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
check("family", "ipv4", "foo", "ipv4")
|
||||
check("dhcp_peerdns", True, False)
|
||||
check("gateway", "1.2.3.4", "5.5.5.5")
|
||||
self.assertEquals(iface.protocols[0].ips[1].address, "255.255.255.0")
|
||||
self.assertEqual(iface.protocols[0].ips[1].address, "255.255.255.0")
|
||||
|
||||
check = self._make_checker(iface.protocols[1])
|
||||
check("dhcp", True, False)
|
||||
|
@ -1064,7 +1064,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
|
||||
check = self._make_checker(child_iface)
|
||||
check("name", "bond-brbond")
|
||||
self.assertEquals(len(child_iface.interfaces), 2)
|
||||
self.assertEqual(len(child_iface.interfaces), 2)
|
||||
|
||||
utils.diff_compare(iface.get_xml_config(), outfile)
|
||||
utils.test_create(conn, iface.get_xml_config(), "interfaceDefineXML")
|
||||
|
@ -1256,7 +1256,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
check("outbound_peak", "5000", "3000")
|
||||
check("outbound_burst", "5120", "5120")
|
||||
|
||||
self.assertEquals(len(net.portgroups), 2)
|
||||
self.assertEqual(len(net.portgroups), 2)
|
||||
check = self._make_checker(net.portgroups[0])
|
||||
check("name", "engineering", "foo")
|
||||
check("default", True, False)
|
||||
|
|
Loading…
Reference in New Issue