From 2ba26e1c3e50d168eb5b5083fa002dc87b078b65 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 3 Dec 2011 12:18:29 +0000 Subject: [PATCH] Renamed assertEquals to assertEqual (unittest API change) --- tests/testalias.py | 28 +++++++-------- tests/testautopolicy.py | 18 +++++----- tests/testdistro.py | 96 ++++++++++++++++++++++++------------------------- tests/testdownload.py | 10 +++--- tests/testgpg.py | 20 +++++------ tests/testifacecache.py | 12 +++---- tests/testlaunch.py | 52 +++++++++++++-------------- tests/testmanifest.py | 14 ++++---- tests/testmodel.py | 82 +++++++++++++++++++++--------------------- tests/testpackagekit.py | 2 +- tests/testreader.py | 32 ++++++++--------- tests/testsat.py | 2 +- tests/testselections.py | 68 +++++++++++++++++------------------ tests/testsolver.py | 22 ++++++------ tests/teststore.py | 14 ++++---- tests/testtrust.py | 14 ++++---- tests/testunpack.py | 4 +-- tests/testwriter.py | 22 ++++++------ 18 files changed, 256 insertions(+), 256 deletions(-) diff --git a/tests/testalias.py b/tests/testalias.py index 4c134da..327c0f0 100755 --- a/tests/testalias.py +++ b/tests/testalias.py @@ -43,15 +43,15 @@ class TestAlias(BaseTest): def testWrite(self): buf = StringIO() alias.write_script(buf, 'http://example.com/foo.xml', None) - self.assertEquals(expected_script, buf.getvalue()) + self.assertEqual(expected_script, buf.getvalue()) buf = StringIO() alias.write_script(buf, 'http://example.com/foo.xml', 'a\'\'\\test') - self.assertEquals(expected_script_main, buf.getvalue()) + self.assertEqual(expected_script_main, buf.getvalue()) buf = StringIO() alias.write_script(buf, 'http://example.com/foo.xml', command = 'a\'\'\\test') - self.assertEquals(expected_script_command, buf.getvalue()) + self.assertEqual(expected_script_command, buf.getvalue()) def testParse(self): tmp = tempfile.NamedTemporaryFile() @@ -59,25 +59,25 @@ class TestAlias(BaseTest): tmp.flush() tmp.seek(0) uri, main = alias.parse_script(tmp.name) - self.assertEquals('http://example.com/foo.xml', uri) - self.assertEquals(None, main) + self.assertEqual('http://example.com/foo.xml', uri) + self.assertEqual(None, main) tmp = tempfile.NamedTemporaryFile() tmp.write(expected_script_main) tmp.flush() tmp.seek(0) uri, main = alias.parse_script(tmp.name) - self.assertEquals('http://example.com/foo.xml', uri) - self.assertEquals('a\'\'\\test', main) + self.assertEqual('http://example.com/foo.xml', uri) + self.assertEqual('a\'\'\\test', main) tmp = tempfile.NamedTemporaryFile() tmp.write(expected_script_command) tmp.flush() tmp.seek(0) info = alias.parse_script(tmp.name) - self.assertEquals('http://example.com/foo.xml', info.uri) - self.assertEquals('a\'\'\\test', info.command) - self.assertEquals(None, info.main) + self.assertEqual('http://example.com/foo.xml', info.uri) + self.assertEqual('a\'\'\\test', info.command) + self.assertEqual(None, info.main) def testParseOld(self): tmp = tempfile.NamedTemporaryFile() @@ -85,16 +85,16 @@ class TestAlias(BaseTest): tmp.flush() tmp.seek(0) uri, main = alias.parse_script(tmp.name) - self.assertEquals('http://example.com/foo.xml', uri) - self.assertEquals(None, main) + self.assertEqual('http://example.com/foo.xml', uri) + self.assertEqual(None, main) tmp = tempfile.NamedTemporaryFile() tmp.write(old_script_main) tmp.flush() tmp.seek(0) uri, main = alias.parse_script(tmp.name) - self.assertEquals('http://example.com/foo.xml', uri) - self.assertEquals('a\'\'\\test', main) + self.assertEqual('http://example.com/foo.xml', uri) + self.assertEqual('a\'\'\\test', main) def testParseException(self): tmp = tempfile.NamedTemporaryFile() diff --git a/tests/testautopolicy.py b/tests/testautopolicy.py index 07ba85b..b637aca 100755 --- a/tests/testautopolicy.py +++ b/tests/testautopolicy.py @@ -179,14 +179,14 @@ class TestAutoPolicy(BaseTest): download_and_execute(policy, ['Hello']) finally: sys.stdout = old - self.assertEquals(cached_impl + '/.:old', + self.assertEqual(cached_impl + '/.:old', os.environ['FOO_PATH']) - self.assertEquals(cached_impl + '/.:/a:/b', + self.assertEqual(cached_impl + '/.:/a:/b', os.environ['BAR_PATH']) - self.assertEquals('val', os.environ['NO_PATH']) + self.assertEqual('val', os.environ['NO_PATH']) - self.assertEquals(os.path.join(local_impl, 'group'), os.environ['SELF_GROUP']) - self.assertEquals(os.path.join(local_impl, 'impl'), os.environ['SELF_IMPL']) + self.assertEqual(os.path.join(local_impl, 'group'), os.environ['SELF_GROUP']) + self.assertEqual(os.path.join(local_impl, 'impl'), os.environ['SELF_IMPL']) del os.environ['FOO_PATH'] if 'XDG_DATA_DIRS' in os.environ: @@ -197,11 +197,11 @@ class TestAutoPolicy(BaseTest): download_and_execute(policy, ['Hello']) finally: sys.stdout = old - self.assertEquals(cached_impl + '/.', + self.assertEqual(cached_impl + '/.', os.environ['FOO_PATH']) - self.assertEquals(cached_impl + '/.:/old', + self.assertEqual(cached_impl + '/.:/old', os.environ['BAR_PATH']) - self.assertEquals(cached_impl + '/.:/usr/local/share:/usr/share', + self.assertEqual(cached_impl + '/.:/usr/local/share:/usr/share', os.environ['XDG_DATA_DIRS']) def testFeeds(self): @@ -234,7 +234,7 @@ class TestAutoPolicy(BaseTest): recalculate(policy) assert policy.ready foo_iface = self.config.iface_cache.get_interface(foo_iface_uri) - self.assertEquals('sha1=123', policy.implementation[foo_iface].id) + self.assertEqual('sha1=123', policy.implementation[foo_iface].id) def testBadConfig(self): path = basedir.save_config_path(namespaces.config_site, diff --git a/tests/testdistro.py b/tests/testdistro.py index 45d31d3..682fc2d 100755 --- a/tests/testdistro.py +++ b/tests/testdistro.py @@ -30,25 +30,25 @@ class TestDistro(BaseTest): src = tempfile.NamedTemporaryFile() try: cache = distro.Cache('test-cache', src.name, 1) - self.assertEquals(None, cache.get("foo")) + self.assertEqual(None, cache.get("foo")) cache.put("foo", "1") - self.assertEquals("1", cache.get("foo")) + self.assertEqual("1", cache.get("foo")) cache.put("foo", "2") - self.assertEquals("2", cache.get("foo")) + self.assertEqual("2", cache.get("foo")) # new cache... cache = distro.Cache('test-cache', src.name, 1) - self.assertEquals("2", cache.get("foo")) + self.assertEqual("2", cache.get("foo")) src.write("hi") src.flush() - self.assertEquals(None, cache.get("foo")) + self.assertEqual(None, cache.get("foo")) cache.put("foo", "3") # new cache... (format change) cache = distro.Cache('test-cache', src.name, 2) - self.assertEquals(None, cache.get("foo")) + self.assertEqual(None, cache.get("foo")) finally: src.close() @@ -68,13 +68,13 @@ class TestDistro(BaseTest): factory = self.make_factory(host) host.get_package_info('gimp', factory) - self.assertEquals(self.feed.implementations, {}) + self.assertEqual(self.feed.implementations, {}) # Special case: we can always find a version of Python master_feed = model.ZeroInstallFeed(None) master_feed.url = 'http://repo.roscidus.com/python/python' feed = host.get_feed(master_feed) - self.assertEquals(1, len(feed.implementations)) + self.assertEqual(1, len(feed.implementations)) def testDebian(self): dpkgdir = os.path.join(os.path.dirname(__file__), 'dpkg') @@ -85,11 +85,11 @@ class TestDistro(BaseTest): factory = self.make_factory(host) host.get_package_info('gimp', factory) - self.assertEquals({}, self.feed.implementations) + self.assertEqual({}, self.feed.implementations) # Initially, we only get information about the installed version... host.get_package_info('python-bittorrent', factory) - self.assertEquals(1, len(self.feed.implementations)) + self.assertEqual(1, len(self.feed.implementations)) # Tell distro to fetch information about candidates... master_feed = parse_impls("""""") @@ -100,36 +100,36 @@ class TestDistro(BaseTest): # Now we see the uninstalled package self.feed = model.ZeroInstallFeed(empty_feed, local_path = '/empty.xml') host.get_package_info('python-bittorrent', factory) - self.assertEquals(2, len(self.feed.implementations)) + self.assertEqual(2, len(self.feed.implementations)) - self.assertEquals(2, len(self.feed.implementations)) + self.assertEqual(2, len(self.feed.implementations)) bittorrent_installed = self.feed.implementations['package:deb:python-bittorrent:3.4.2-10:*'] bittorrent_uninstalled = self.feed.implementations['package:deb:python-bittorrent:3.4.2-11.1:*'] - self.assertEquals('3.4.2-10', bittorrent_installed.get_version()) + self.assertEqual('3.4.2-10', bittorrent_installed.get_version()) self.assertTrue(bittorrent_installed.installed) self.assertFalse(bittorrent_uninstalled.installed) - self.assertEquals(None, bittorrent_installed.machine) + self.assertEqual(None, bittorrent_installed.machine) self.feed = model.ZeroInstallFeed(empty_feed, local_path = '/empty.xml') host.get_package_info('libxcomposite-dev', factory) - self.assertEquals(1, len(self.feed.implementations)) + self.assertEqual(1, len(self.feed.implementations)) libxcomposite = self.feed.implementations['package:deb:libxcomposite-dev:0.3.1-1:i386'] - self.assertEquals('0.3.1-1', libxcomposite.get_version()) - self.assertEquals('i386', libxcomposite.machine) + self.assertEqual('0.3.1-1', libxcomposite.get_version()) + self.assertEqual('i386', libxcomposite.machine) def testRPM(self): rpmdir = os.path.join(os.path.dirname(__file__), 'rpm') os.environ['PATH'] = rpmdir + ':' + self.old_path rpm = distro.RPMDistribution(os.path.join(rpmdir, 'status')) - self.assertEquals(2, len(rpm.versions)) + self.assertEqual(2, len(rpm.versions)) factory = self.make_factory(rpm) rpm.get_package_info('yast2-update', factory) - self.assertEquals(1, len(self.feed.implementations)) + self.assertEqual(1, len(self.feed.implementations)) yast = self.feed.implementations['package:rpm:yast2-update:2.15.23-21:i586'] - self.assertEquals('2.15.23-21', yast.get_version()) - self.assertEquals('*-i586', yast.arch) + self.assertEqual('2.15.23-21', yast.get_version()) + self.assertEqual('*-i586', yast.arch) icache = iface_cache.IfaceCache(distro = rpm) @@ -140,7 +140,7 @@ class TestDistro(BaseTest): icache._feeds[feed.url] = feed distro_feed_url = feed.get_distro_feed() impls = icache.get_feed(distro_feed_url).implementations - self.assertEquals("distribution:myfeed.xml", distro_feed_url) + self.assertEqual("distribution:myfeed.xml", distro_feed_url) assert len(impls) == 1, impls impl, = impls assert impl == 'package:rpm:yast2-update:2.15.23-21:i586' @@ -169,13 +169,13 @@ class TestDistro(BaseTest): factory = self.make_factory(slack) slack.get_package_info('gimp', factory) - self.assertEquals({}, self.feed.implementations) + self.assertEqual({}, self.feed.implementations) slack.get_package_info('infozip', factory) - self.assertEquals(1, len(self.feed.implementations)) + self.assertEqual(1, len(self.feed.implementations)) zip = self.feed.implementations['package:slack:infozip:5.52-2:i486'] - self.assertEquals('5.52-2', zip.get_version()) - self.assertEquals('i486', zip.machine) + self.assertEqual('5.52-2', zip.get_version()) + self.assertEqual('i486', zip.machine) def testGentoo(self): pkgdir = os.path.join(os.path.dirname(__file__), 'gentoo') @@ -183,28 +183,28 @@ class TestDistro(BaseTest): factory = self.make_factory(ebuilds) ebuilds.get_package_info('media-gfx/gimp', factory) - self.assertEquals({}, self.feed.implementations) + self.assertEqual({}, self.feed.implementations) ebuilds.get_package_info('sys-apps/portage', factory) - self.assertEquals(1, len(self.feed.implementations)) + self.assertEqual(1, len(self.feed.implementations)) impl = self.feed.implementations['package:gentoo:sys-apps/portage:2.1.7.16:x86_64'] - self.assertEquals('2.1.7.16', impl.get_version()) - self.assertEquals('x86_64', impl.machine) + self.assertEqual('2.1.7.16', impl.get_version()) + self.assertEqual('x86_64', impl.machine) ebuilds.get_package_info('sys-kernel/gentoo-sources', factory) - self.assertEquals(3, len(self.feed.implementations)) + self.assertEqual(3, len(self.feed.implementations)) impl = self.feed.implementations['package:gentoo:sys-kernel/gentoo-sources:2.6.30-4:i686'] - self.assertEquals('2.6.30-4', impl.get_version()) - self.assertEquals('i686', impl.machine) + self.assertEqual('2.6.30-4', impl.get_version()) + self.assertEqual('i686', impl.machine) impl = self.feed.implementations['package:gentoo:sys-kernel/gentoo-sources:2.6.32:x86_64'] - self.assertEquals('2.6.32', impl.get_version()) - self.assertEquals('x86_64', impl.machine) + self.assertEqual('2.6.32', impl.get_version()) + self.assertEqual('x86_64', impl.machine) ebuilds.get_package_info('app-emulation/emul-linux-x86-baselibs', factory) - self.assertEquals(4, len(self.feed.implementations)) + self.assertEqual(4, len(self.feed.implementations)) impl = self.feed.implementations['package:gentoo:app-emulation/emul-linux-x86-baselibs:20100220:i386'] - self.assertEquals('20100220', impl.get_version()) - self.assertEquals('i386', impl.machine) + self.assertEqual('20100220', impl.get_version()) + self.assertEqual('i386', impl.machine) def testPorts(self): pkgdir = os.path.join(os.path.dirname(__file__), 'ports') @@ -212,10 +212,10 @@ class TestDistro(BaseTest): factory = self.make_factory(ports) ports.get_package_info('zeroinstall-injector', factory) - self.assertEquals(1, len(self.feed.implementations)) + self.assertEqual(1, len(self.feed.implementations)) impl = self.feed.implementations['package:ports:zeroinstall-injector:0.41-2:' + distro.host_machine] - self.assertEquals('0.41-2', impl.get_version()) - self.assertEquals(distro.host_machine, impl.machine) + self.assertEqual('0.41-2', impl.get_version()) + self.assertEqual(distro.host_machine, impl.machine) def testMacPorts(self): pkgdir = os.path.join(os.path.dirname(__file__), 'macports') @@ -224,16 +224,16 @@ class TestDistro(BaseTest): factory = self.make_factory(ports) ports.get_package_info('zeroinstall-injector', factory) - self.assertEquals(1, len(self.feed.implementations)) + self.assertEqual(1, len(self.feed.implementations)) impl = self.feed.implementations['package:macports:zeroinstall-injector:1.0-0:*'] - self.assertEquals('1.0-0', impl.get_version()) - self.assertEquals(None, impl.machine) + self.assertEqual('1.0-0', impl.get_version()) + self.assertEqual(None, impl.machine) def testCleanVersion(self): - self.assertEquals('0.3.1-1', distro.try_cleanup_distro_version('1:0.3.1-1')) - self.assertEquals('0.3.1-1', distro.try_cleanup_distro_version('0.3.1-1ubuntu0')) - self.assertEquals('0.3-post1-rc2', distro.try_cleanup_distro_version('0.3-post1-rc2')) - self.assertEquals('0.3.1-2', distro.try_cleanup_distro_version('0.3.1-r2-r3')) + self.assertEqual('0.3.1-1', distro.try_cleanup_distro_version('1:0.3.1-1')) + self.assertEqual('0.3.1-1', distro.try_cleanup_distro_version('0.3.1-1ubuntu0')) + self.assertEqual('0.3-post1-rc2', distro.try_cleanup_distro_version('0.3-post1-rc2')) + self.assertEqual('0.3.1-2', distro.try_cleanup_distro_version('0.3.1-r2-r3')) if __name__ == '__main__': unittest.main() diff --git a/tests/testdownload.py b/tests/testdownload.py index 7acfd83..e70644f 100755 --- a/tests/testdownload.py +++ b/tests/testdownload.py @@ -144,7 +144,7 @@ class TestDownload(BaseTest): rootLogger.setLevel(WARN) hello = self.config.iface_cache.get_feed('http://localhost:8000/Hello') - self.assertEquals(None, hello) + self.assertEqual(None, hello) with output_suppressed(): run_server('6FCF121BE2390E0B.gpg') @@ -156,7 +156,7 @@ class TestDownload(BaseTest): # Check we imported the interface after trusting the key hello = self.config.iface_cache.get_feed('http://localhost:8000/Hello', force = True) - self.assertEquals(1, len(hello.implementations)) + self.assertEqual(1, len(hello.implementations)) # Shouldn't need to prompt the second time sys.stdin = None @@ -305,7 +305,7 @@ class TestDownload(BaseTest): except model.SafeException as ex: if 'Attempt to unpack dir over symlink "HelloWorld"' not in str(ex): raise - self.assertEquals(None, basedir.load_first_cache('0install.net', 'implementations', 'main')) + self.assertEqual(None, basedir.load_first_cache('0install.net', 'implementations', 'main')) finally: sys.stdout = old_out @@ -382,7 +382,7 @@ class TestDownload(BaseTest): assert "New feed's modification time is before old version" in str(ex) # Must finish with the newest version - self.assertEquals(1235911552, self.config.iface_cache._get_signature_date(iface.uri)) + self.assertEqual(1235911552, self.config.iface_cache._get_signature_date(iface.uri)) finally: sys.stdout = old_out @@ -430,7 +430,7 @@ class TestDownload(BaseTest): background.spawn_background_update(p, verbose) assert False except SystemExit as ex: - self.assertEquals(1, ex.code) + self.assertEqual(1, ex.code) finally: os._exit = old_exit config.DEFAULT_KEY_LOOKUP_SERVER = key_info diff --git a/tests/testgpg.py b/tests/testgpg.py index bd2b6d9..dc3abb2 100755 --- a/tests/testgpg.py +++ b/tests/testgpg.py @@ -104,16 +104,16 @@ class TestGPG(BaseTest): stream.write(err_sig) stream.seek(0) data, sigs = gpg.check_stream(stream) - self.assertEquals(err_sig, data.read()) + self.assertEqual(err_sig, data.read()) assert len(sigs) == 1 assert isinstance(sigs[0], gpg.ErrSig) assert sigs[0].need_key() == "7AB89A977DAAA397" - self.assertEquals("1", sigs[0].status[gpg.ErrSig.ALG]) + self.assertEqual("1", sigs[0].status[gpg.ErrSig.ALG]) assert sigs[0].is_trusted() is False assert str(sigs[0]).startswith('ERROR') def testBadXMLSig(self): - self.assertEquals(bad_xml_sig, self.check_bad(bad_xml_sig)) + self.assertEqual(bad_xml_sig, self.check_bad(bad_xml_sig)) def testInvalidXMLSig(self): for error, sig in invalid_xmls_sigs: @@ -130,7 +130,7 @@ class TestGPG(BaseTest): data, sigs = gpg.check_stream(stream) assert len(sigs) == 1 assert isinstance(sigs[0], gpg.BadSig) - self.assertEquals("AE07828059A53CC1", + self.assertEqual("AE07828059A53CC1", sigs[0].status[gpg.BadSig.KEYID]) assert sigs[0].is_trusted() is False assert sigs[0].need_key() is None @@ -138,7 +138,7 @@ class TestGPG(BaseTest): return data.read() def testGoodXMLSig(self): - self.assertEquals(good_xml_sig, self.check_good(good_xml_sig)) + self.assertEqual(good_xml_sig, self.check_good(good_xml_sig)) def check_good(self, sig): stream = tempfile.TemporaryFile() @@ -147,7 +147,7 @@ class TestGPG(BaseTest): data, sigs = gpg.check_stream(stream) assert len(sigs) == 1 assert isinstance(sigs[0], gpg.ValidSig) - self.assertEquals("92429807C9853C0744A68B9AAE07828059A53CC1", + self.assertEqual("92429807C9853C0744A68B9AAE07828059A53CC1", sigs[0].fingerprint) assert sigs[0].is_trusted() is True assert sigs[0].need_key() is None @@ -172,12 +172,12 @@ class TestGPG(BaseTest): def testLoadKeys(self): - self.assertEquals({}, gpg.load_keys([])) + self.assertEqual({}, gpg.load_keys([])) keys = gpg.load_keys([THOMAS_FINGERPRINT]) - self.assertEquals(1, len(keys)) + self.assertEqual(1, len(keys)) key = keys[THOMAS_FINGERPRINT] - self.assertEquals(THOMAS_FINGERPRINT, key.fingerprint) - self.assertEquals('Thomas Leonard ', + self.assertEqual(THOMAS_FINGERPRINT, key.fingerprint) + self.assertEqual('Thomas Leonard ', key.name) if __name__ == '__main__': diff --git a/tests/testifacecache.py b/tests/testifacecache.py index f36a558..a0d3eca 100755 --- a/tests/testifacecache.py +++ b/tests/testifacecache.py @@ -13,10 +13,10 @@ from zeroinstall.support import basedir class TestIfaceCache(BaseTest): def testList(self): iface_cache = self.config.iface_cache - self.assertEquals([], iface_cache.list_all_interfaces()) + self.assertEqual([], iface_cache.list_all_interfaces()) iface_dir = basedir.save_cache_path(config_site, 'interfaces') open(os.path.join(iface_dir, 'http%3a%2f%2ffoo'), 'w').close() - self.assertEquals(['http://foo'], + self.assertEqual(['http://foo'], iface_cache.list_all_interfaces()) # TODO: test overrides @@ -52,12 +52,12 @@ class TestIfaceCache(BaseTest): pending = PendingFeed(feed_url, src) assert iface_cache.update_feed_if_trusted(feed_url, pending.sigs, pending.new_xml) - self.assertEquals(['http://foo'], + self.assertEqual(['http://foo'], iface_cache.list_all_interfaces()) feed = iface_cache.get_feed(feed_url) - self.assertEquals(1154850229, feed.last_modified) + self.assertEqual(1154850229, feed.last_modified) def testXMLupdate(self): iface_cache = self.config.iface_cache @@ -144,7 +144,7 @@ class TestIfaceCache(BaseTest): def testCheckAttempt(self): iface_cache = self.config.iface_cache - self.assertEquals(None, iface_cache.get_last_check_attempt("http://foo/bar.xml")) + self.assertEqual(None, iface_cache.get_last_check_attempt("http://foo/bar.xml")) start_time = time.time() - 5 # Seems to be some odd rounding here iface_cache.mark_as_checking("http://foo/bar.xml") @@ -153,7 +153,7 @@ class TestIfaceCache(BaseTest): assert last_check is not None assert last_check >= start_time, (last_check, start_time) - self.assertEquals(None, iface_cache.get_last_check_attempt("http://foo/bar2.xml")) + self.assertEqual(None, iface_cache.get_last_check_attempt("http://foo/bar2.xml")) def testIsStale(self): iface_cache = self.config.iface_cache diff --git a/tests/testlaunch.py b/tests/testlaunch.py index 91464d0..69a3dd8 100755 --- a/tests/testlaunch.py +++ b/tests/testlaunch.py @@ -63,7 +63,7 @@ class TestLaunch(BaseTest): def testList(self): out, err = self.run_0launch(['--list']) assert not err - self.assertEquals("Finished\n", out) + self.assertEqual("Finished\n", out) cached_ifaces = os.path.join(self.cache_home, '0install.net', 'interfaces') @@ -72,15 +72,15 @@ class TestLaunch(BaseTest): out, err = self.run_0launch(['--list']) assert not err - self.assertEquals("file://foo\nFinished\n", out) + self.assertEqual("file://foo\nFinished\n", out) out, err = self.run_0launch(['--list', 'foo']) assert not err - self.assertEquals("file://foo\nFinished\n", out) + self.assertEqual("file://foo\nFinished\n", out) out, err = self.run_0launch(['--list', 'bar']) assert not err - self.assertEquals("Finished\n", out) + self.assertEqual("Finished\n", out) out, err = self.run_0launch(['--list', 'one', 'two']) assert not err @@ -98,12 +98,12 @@ class TestLaunch(BaseTest): def testOK(self): out, err = self.run_0launch(['--dry-run', 'http://foo/d']) - self.assertEquals("Would download 'http://foo/d'\nFinished\n", out) - self.assertEquals("", err) + self.assertEqual("Would download 'http://foo/d'\nFinished\n", out) + self.assertEqual("", err) def testRun(self): out, err = self.run_0launch(['Local.xml']) - self.assertEquals("", out) + self.assertEqual("", out) assert "test-echo' does not exist" in err, err def testAbsMain(self): @@ -133,8 +133,8 @@ class TestLaunch(BaseTest): def testOffline(self): out, err = self.run_0launch(['--offline', 'http://foo/d']) - self.assertEquals("Interface 'http://foo/d' has no usable implementations in the cache (and 0install is in off-line mode)\n", err) - self.assertEquals("", out) + self.assertEqual("Interface 'http://foo/d' has no usable implementations in the cache (and 0install is in off-line mode)\n", err) + self.assertEqual("", out) def testDisplay(self): os.environ['DISPLAY'] = ':foo' @@ -142,43 +142,43 @@ class TestLaunch(BaseTest): # Uses local copy of GUI assert out.startswith("Would execute: ") assert 'basetest.py' in out - self.assertEquals("", err) + self.assertEqual("", err) del os.environ['DISPLAY'] out, err = self.run_0launch(['--gui', '--dry-run']) - self.assertEquals("", err) - self.assertEquals("Finished\n", out) + self.assertEqual("", err) + self.assertEqual("Finished\n", out) def testRefreshDisplay(self): os.environ['DISPLAY'] = ':foo' out, err = self.run_0launch(['--dry-run', '--refresh', 'http://foo/d']) assert out.startswith("Would execute: ") assert 'basetest.py' in out - self.assertEquals("", err) + self.assertEqual("", err) def testNeedDownload(self): os.environ['DISPLAY'] = ':foo' out, err = self.run_0launch(['--download-only', '--dry-run', 'Foo.xml']) - self.assertEquals("", err) - self.assertEquals("Finished\n", out) + self.assertEqual("", err) + self.assertEqual("Finished\n", out) def testSelectOnly(self): os.environ['DISPLAY'] = ':foo' out, err = self.run_0launch(['--get-selections', '--select-only', 'Hello.xml']) - self.assertEquals("", err) + self.assertEqual("", err) assert out.endswith("Finished\n") out = out[:-len("Finished\n")] root = qdom.parse(StringIO(str(out))) - self.assertEquals(namespaces.XMLNS_IFACE, root.uri) + self.assertEqual(namespaces.XMLNS_IFACE, root.uri) sels = selections.Selections(root) sel,= sels.selections.values() - self.assertEquals("sha1=3ce644dc725f1d21cfcf02562c76f375944b266a", sel.id) + self.assertEqual("sha1=3ce644dc725f1d21cfcf02562c76f375944b266a", sel.id) def testHello(self): out, err = self.run_0launch(['--dry-run', 'Foo.xml']) - self.assertEquals("", err) + self.assertEqual("", err) assert out.startswith("Would execute: ") out, err = self.run_0launch(['Foo.xml']) @@ -187,34 +187,34 @@ class TestLaunch(BaseTest): def testSource(self): out, err = self.run_0launch(['--dry-run', '--source', 'Source.xml']) - self.assertEquals("", err) + self.assertEqual("", err) assert 'Compiler.xml' in out def testRanges(self): out, err = self.run_0launch(['--get-selections', '--before=1', '--not-before=0.2', 'Foo.xml']) assert 'tests/rpm' in out, out - self.assertEquals("", err) + self.assertEqual("", err) def testLogging(self): log = logging.getLogger() log.addFilter(silenceLogger) out, err = self.run_0launch(['-v', '--list', 'UNKNOWN']) - self.assertEquals(logging.INFO, log.level) + self.assertEqual(logging.INFO, log.level) out, err = self.run_0launch(['-vv', '--version']) - self.assertEquals(logging.DEBUG, log.level) + self.assertEqual(logging.DEBUG, log.level) log.removeFilter(silenceLogger) log.setLevel(logging.WARN) def testHelp2(self): out, err = self.run_0launch(['--help']) - self.assertEquals("", err) + self.assertEqual("", err) assert 'options:' in out.lower() out, err = self.run_0launch([]) - self.assertEquals("", err) + self.assertEqual("", err) assert 'options:' in out.lower() def testBadFD(self): @@ -228,7 +228,7 @@ class TestLaunch(BaseTest): def testShow(self): command_feed = os.path.join(mydir, 'Command.xml') out, err = self.run_0launch(['--show', command_feed]) - self.assertEquals("", err) + self.assertEqual("", err) assert 'Local.xml' in out, out if __name__ == '__main__': diff --git a/tests/testmanifest.py b/tests/testmanifest.py index 9d37b96..267e83b 100755 --- a/tests/testmanifest.py +++ b/tests/testmanifest.py @@ -23,7 +23,7 @@ class TestManifest(BaseTest): pass def testEmpty(self): - self.assertEquals('', + self.assertEqual('', '\n'.join(manifest.generate_manifest(self.tmpdir))) def write(self, path, contents, time = None): @@ -44,7 +44,7 @@ class TestManifest(BaseTest): os.symlink('Hello', os.path.join(self.tmpdir, 'MyDir/Sym link')) os.chmod(myexec, 0o700) os.utime(mydir, (10, 20)) - self.assertEquals([ + self.assertEqual([ 'D 20 /MyDir', 'F 0a4d55a8d778e5022fab701977c5d840bbc486d0 30 11 Hello', 'X 4001b8c42ddfb61c453d04930e8ce78fb3a40bc8 40 5 Run me', @@ -59,7 +59,7 @@ class TestManifest(BaseTest): os.symlink('Hello', os.path.join(self.tmpdir, 'MyDir/Sym link')) os.chmod(myexec, 0o700) os.utime(mydir, (10, 20)) - self.assertEquals([ + self.assertEqual([ 'D /MyDir', 'F 0a4d55a8d778e5022fab701977c5d840bbc486d0 30 11 Hello', 'X 4001b8c42ddfb61c453d04930e8ce78fb3a40bc8 40 5 Run me', @@ -72,7 +72,7 @@ class TestManifest(BaseTest): self.write('Hello', 'Hello World', 30) self.write('Dir/Hello', 'Hello World', 30) os.utime(mydir, (10, 20)) - self.assertEquals([ + self.assertEqual([ 'F 0a4d55a8d778e5022fab701977c5d840bbc486d0 30 11 Hello', 'D /Dir', 'F 0a4d55a8d778e5022fab701977c5d840bbc486d0 30 11 Hello'], @@ -85,7 +85,7 @@ class TestManifest(BaseTest): myexec = self.write('MyDir/Run me', 'Bang!', 40) os.symlink('Hello', os.path.join(self.tmpdir, 'MyDir/Sym link')) os.chmod(myexec, 0o700) - self.assertEquals([ + self.assertEqual([ 'D /MyDir', 'F a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e 30 11 Hello', 'X 640628586b08f8ed3910bd1e75ba02818959e843b54efafb9c2260a1f77e3ddf 40 5 Run me', @@ -97,13 +97,13 @@ class TestManifest(BaseTest): os.mkdir(mydir) self.write('Hello', 'Hello World', 30) os.utime(mydir, (10, 20)) - self.assertEquals([ + self.assertEqual([ 'F a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e 30 11 Hello', 'D /Dir'], list(manifest.generate_manifest(self.tmpdir, alg='sha256'))) def testParseManifest(self): - self.assertEquals({}, manifest._parse_manifest('')) + self.assertEqual({}, manifest._parse_manifest('')) parsed = manifest._parse_manifest('F e3d5983c3dfd415af24772b48276d16122fe5a87 1172429666 2980 README\n' 'X 8a1f3c5f416f0e63140928102c44cd16ec2c6100 1172429666 5816 install.sh\n' 'D /0install\n' diff --git a/tests/testmodel.py b/tests/testmodel.py index 237cc8c..5f2e049 100755 --- a/tests/testmodel.py +++ b/tests/testmodel.py @@ -29,41 +29,41 @@ class TestModel(BaseTest): str(model.insecure) def testEscape(self): - self.assertEquals("", model.escape("")) - self.assertEquals("hello", model.escape("hello")) - self.assertEquals("%20", model.escape(" ")) + self.assertEqual("", model.escape("")) + self.assertEqual("hello", model.escape("hello")) + self.assertEqual("%20", model.escape(" ")) - self.assertEquals("file%3a%2f%2ffoo%7ebar", + self.assertEqual("file%3a%2f%2ffoo%7ebar", model.escape("file://foo~bar")) - self.assertEquals("file%3a%2f%2ffoo%25bar", + self.assertEqual("file%3a%2f%2ffoo%25bar", model.escape("file://foo%bar")) - self.assertEquals("file:##foo%7ebar", + self.assertEqual("file:##foo%7ebar", model._pretty_escape("file://foo~bar")) - self.assertEquals("file:##foo%25bar", + self.assertEqual("file:##foo%25bar", model._pretty_escape("file://foo%bar")) def testUnescape(self): - self.assertEquals("", model.unescape("")) - self.assertEquals("hello", model.unescape("hello")) - self.assertEquals(" ", model.unescape("%20")) + self.assertEqual("", model.unescape("")) + self.assertEqual("hello", model.unescape("hello")) + self.assertEqual(" ", model.unescape("%20")) - self.assertEquals("file://foo~bar", + self.assertEqual("file://foo~bar", model.unescape("file%3a%2f%2ffoo%7ebar")) - self.assertEquals("file://foo%bar", + self.assertEqual("file://foo%bar", model.unescape("file%3a%2f%2ffoo%25bar")) - self.assertEquals("file://foo", + self.assertEqual("file://foo", model.unescape("file:##foo")) - self.assertEquals("file://foo~bar", + self.assertEqual("file://foo~bar", model.unescape("file:##foo%7ebar")) - self.assertEquals("file://foo%bar", + self.assertEqual("file://foo%bar", model.unescape("file:##foo%25bar")) def testEscaping(self): def check(str): - self.assertEquals(str, model.unescape(model.escape(str))) - self.assertEquals(str, model.unescape(model._pretty_escape(str))) + self.assertEqual(str, model.unescape(model.escape(str))) + self.assertEqual(str, model.unescape(model._pretty_escape(str))) check('http://example.com') check('http://example%46com') @@ -80,9 +80,9 @@ class TestModel(BaseTest): def testInterface(self): i = model.Interface('http://foo') - self.assertEquals('(foo)', i.get_name()) + self.assertEqual('(foo)', i.get_name()) feed = model.ZeroInstallFeed(empty_feed, local_path = '/foo') - self.assertEquals('Empty', feed.get_name()) + self.assertEqual('Empty', feed.get_name()) repr(i) def testMetadata(self): @@ -99,26 +99,26 @@ class TestModel(BaseTest): dom = qdom.parse(open(local_path)) feed = model.ZeroInstallFeed(dom, local_path = local_path) # (defaults to en-US if no language is set in the locale) - self.assertEquals("Local feed (English)", feed.summary) - self.assertEquals("English", feed.description) + self.assertEqual("Local feed (English)", feed.summary) + self.assertEqual("English", feed.description) - self.assertEquals(4, len(feed.summaries)) - self.assertEquals(2, len(feed.descriptions)) + self.assertEqual(4, len(feed.summaries)) + self.assertEqual(2, len(feed.descriptions)) try: basetest.test_locale = ('es_ES', 'UTF8') - self.assertEquals("Fuente local", feed.summary) - self.assertEquals("Español", feed.description) + self.assertEqual("Fuente local", feed.summary) + self.assertEqual("Español", feed.description) basetest.test_locale = ('en_GB', 'UTF8') - self.assertEquals("Local feed (English GB)", feed.summary) + self.assertEqual("Local feed (English GB)", feed.summary) basetest.test_locale = ('fr_FR', 'UTF8') - self.assertEquals("Local feed (English)", feed.summary) - self.assertEquals("English", feed.description) + self.assertEqual("Local feed (English)", feed.summary) + self.assertEqual("English", feed.description) finally: basetest.test_locale = (None, None) @@ -141,9 +141,9 @@ class TestModel(BaseTest): def testStabPolicy(self): i = model.Interface('http://foo') - self.assertEquals(None, i.stability_policy) + self.assertEqual(None, i.stability_policy) i.set_stability_policy(model.buggy) - self.assertEquals(model.buggy, i.stability_policy) + self.assertEqual(model.buggy, i.stability_policy) def testImpl(self): i = model.Interface('http://foo') @@ -159,9 +159,9 @@ class TestModel(BaseTest): a.user_stability = model.buggy assert a.get_stability() is model.buggy a.version = model.parse_version('1.2.3') - self.assertEquals('1.2.3', a.get_version()) + self.assertEqual('1.2.3', a.get_version()) a.version = model.parse_version('1.2.3-rc2-post') - self.assertEquals('1.2.3-rc2-post', a.get_version()) + self.assertEqual('1.2.3-rc2-post', a.get_version()) assert str(a) == 'foo' b = model.ZeroInstallImplementation(i, 'foo', None) @@ -190,24 +190,24 @@ class TestModel(BaseTest): assert prepend.insert == 'lib' assert prepend.mode is model.EnvironmentBinding.PREPEND - self.assertEquals('/impl/lib:/usr/lib', prepend.get_value('/impl', '/usr/lib')) - self.assertEquals('/impl/lib', prepend.get_value('/impl', None)) + self.assertEqual('/impl/lib:/usr/lib', prepend.get_value('/impl', '/usr/lib')) + self.assertEqual('/impl/lib', prepend.get_value('/impl', None)) append = model.EnvironmentBinding('PYTHONPATH', 'lib', '/opt/lib', model.EnvironmentBinding.APPEND) assert append.name == 'PYTHONPATH' assert append.insert == 'lib' assert append.mode is model.EnvironmentBinding.APPEND - self.assertEquals('/usr/lib:/impl/lib', append.get_value('/impl', '/usr/lib')) - self.assertEquals('/opt/lib:/impl/lib', append.get_value('/impl', None)) + self.assertEqual('/usr/lib:/impl/lib', append.get_value('/impl', '/usr/lib')) + self.assertEqual('/opt/lib:/impl/lib', append.get_value('/impl', None)) append = model.EnvironmentBinding('PYTHONPATH', 'lib', None, model.EnvironmentBinding.REPLACE) assert append.name == 'PYTHONPATH' assert append.insert == 'lib' assert append.mode is model.EnvironmentBinding.REPLACE - self.assertEquals('/impl/lib', append.get_value('/impl', '/usr/lib')) - self.assertEquals('/impl/lib', append.get_value('/impl', None)) + self.assertEqual('/impl/lib', append.get_value('/impl', '/usr/lib')) + self.assertEqual('/impl/lib', append.get_value('/impl', None)) assert model.EnvironmentBinding('PYTHONPATH', 'lib').mode == model.EnvironmentBinding.PREPEND @@ -217,13 +217,13 @@ class TestModel(BaseTest): (b'', '')]: e = qdom.parse(BytesIO(xml)) ol = model.process_binding(e) - self.assertEquals(expected, str(ol)) + self.assertEqual(expected, str(ol)) doc = minidom.parseString('') new_xml = str(ol._toxml(doc).toxml()) new_e = qdom.parse(BytesIO(new_xml)) new_ol = model.process_binding(new_e) - self.assertEquals(expected, str(new_ol)) + self.assertEqual(expected, str(new_ol)) def testDep(self): b = model.InterfaceDependency('http://foo', element = qdom.Element(namespaces.XMLNS_IFACE, 'requires', {})) @@ -267,7 +267,7 @@ class TestModel(BaseTest): except model.SafeException as ex: assert 'Missing /' in str(ex) - self.assertEquals('http://foo/', + self.assertEqual('http://foo/', model.canonical_iface_uri('http://foo/')) try: model.canonical_iface_uri('bad-name') diff --git a/tests/testpackagekit.py b/tests/testpackagekit.py index d51fee7..0d650e2 100755 --- a/tests/testpackagekit.py +++ b/tests/testpackagekit.py @@ -178,7 +178,7 @@ class TestPackageKit(BaseTest): return impl pk.get_candidates('gimp', factory, 'package:test') - self.assertEquals(["package:test:gimp:2.6.8-2:x86_64"], impls.keys()) + self.assertEqual(["package:test:gimp:2.6.8-2:x86_64"], impls.keys()) impl, = impls.values() fetcher = fetch.Fetcher(config = self.config) diff --git a/tests/testreader.py b/tests/testreader.py index e8c52ba..8dd0b3a 100755 --- a/tests/testreader.py +++ b/tests/testreader.py @@ -152,28 +152,28 @@ class TestReader(BaseTest): impl = feed.implementations['sha1=123'] assert len(impl.bindings) == 1 - self.assertEquals(model.EnvironmentBinding.REPLACE, impl.bindings[0].mode) + self.assertEqual(model.EnvironmentBinding.REPLACE, impl.bindings[0].mode) assert len(impl.requires) == 1 dep = impl.requires[0] assert len(dep.bindings) == 5 for b in dep.bindings: - self.assertEquals('PATH', b.name) - self.assertEquals('bin', b.insert) - self.assertEquals(model.EnvironmentBinding.PREPEND, dep.bindings[0].mode) - self.assertEquals(model.EnvironmentBinding.PREPEND, dep.bindings[1].mode) - self.assertEquals(model.EnvironmentBinding.APPEND, dep.bindings[2].mode) - self.assertEquals(model.EnvironmentBinding.REPLACE, dep.bindings[3].mode) - self.assertEquals(model.EnvironmentBinding.PREPEND, dep.bindings[4].mode) + self.assertEqual('PATH', b.name) + self.assertEqual('bin', b.insert) + self.assertEqual(model.EnvironmentBinding.PREPEND, dep.bindings[0].mode) + self.assertEqual(model.EnvironmentBinding.PREPEND, dep.bindings[1].mode) + self.assertEqual(model.EnvironmentBinding.APPEND, dep.bindings[2].mode) + self.assertEqual(model.EnvironmentBinding.REPLACE, dep.bindings[3].mode) + self.assertEqual(model.EnvironmentBinding.PREPEND, dep.bindings[4].mode) - self.assertEquals(os.path.join('/impl', 'bin:current'), + self.assertEqual(os.path.join('/impl', 'bin:current'), dep.bindings[0].get_value('/impl', 'current')) - self.assertEquals(os.path.join('/impl', 'bin,current'), + self.assertEqual(os.path.join('/impl', 'bin,current'), dep.bindings[4].get_value('/impl', 'current')) - self.assertEquals(None, dep.bindings[1].default) - self.assertEquals('/bin', dep.bindings[2].default) + self.assertEqual(None, dep.bindings[1].default) + self.assertEqual('/bin', dep.bindings[2].default) def testVersions(self): tmp = tempfile.NamedTemporaryFile(prefix = 'test-') @@ -282,11 +282,11 @@ class TestReader(BaseTest): assert len(feed.implementations) == 3 assert len(feed.feeds) == 1, feed.feeds - self.assertEquals('fr en-GB', feed.feeds[0].langs) + self.assertEqual('fr en-GB', feed.feeds[0].langs) - self.assertEquals('fr', feed.implementations['sha1=124'].langs) - self.assertEquals('fr en-GB', feed.implementations['sha1=234'].langs) - self.assertEquals('', feed.implementations['sha1=345'].langs) + self.assertEqual('fr', feed.implementations['sha1=124'].langs) + self.assertEqual('fr en-GB', feed.implementations['sha1=234'].langs) + self.assertEqual('', feed.implementations['sha1=345'].langs) if __name__ == '__main__': unittest.main() diff --git a/tests/testsat.py b/tests/testsat.py index b1dfeee..8218667 100755 --- a/tests/testsat.py +++ b/tests/testsat.py @@ -289,7 +289,7 @@ class TestSAT(BaseTest): for iface_uri, impl in s.selections.selections.iteritems(): if impl is not None: impl = impl.version selected[iface_uri.rsplit('/', 1)[1]] = impl - self.assertEquals({ + self.assertEqual({ 'prog': '2', 'liba': '2', 'libb': '2', diff --git a/tests/testselections.py b/tests/testselections.py index ff83f0a..a9b4b44 100755 --- a/tests/testselections.py +++ b/tests/testselections.py @@ -26,49 +26,49 @@ class TestSelections(BaseTest): assert p.need_download() def assertSel(s): - self.assertEquals('http://foo/Source.xml', s.interface) - self.assertEquals(2, len(s.selections)) + self.assertEqual('http://foo/Source.xml', s.interface) + self.assertEqual(2, len(s.selections)) sels = [(sel.interface, sel) for sel in s.selections.values()] sels.sort() sels = [sel for uri,sel in sels] - self.assertEquals('http://foo/Compiler.xml', sels[0].interface) - self.assertEquals('http://foo/Source.xml', sels[1].interface) + self.assertEqual('http://foo/Compiler.xml', sels[0].interface) + self.assertEqual('http://foo/Source.xml', sels[1].interface) - self.assertEquals("sha1=345", sels[0].id) - self.assertEquals("1.0", sels[0].version) + self.assertEqual("sha1=345", sels[0].id) + self.assertEqual("1.0", sels[0].version) - self.assertEquals('sha1=234', sels[1].id) - self.assertEquals("1.0", sels[1].version) - self.assertEquals("bar", sels[1].attrs['http://namespace foo']) - self.assertEquals("1.0", sels[1].attrs['version']) + self.assertEqual('sha1=234', sels[1].id) + self.assertEqual("1.0", sels[1].version) + self.assertEqual("bar", sels[1].attrs['http://namespace foo']) + self.assertEqual("1.0", sels[1].attrs['version']) assert 'version-modifier' not in sels[1].attrs - self.assertEquals(0, len(sels[0].bindings)) - self.assertEquals(0, len(sels[0].dependencies)) + self.assertEqual(0, len(sels[0].bindings)) + self.assertEqual(0, len(sels[0].dependencies)) - self.assertEquals(1, len(sels[1].bindings)) - self.assertEquals('.', sels[1].bindings[0].insert) + self.assertEqual(1, len(sels[1].bindings)) + self.assertEqual('.', sels[1].bindings[0].insert) - self.assertEquals(1, len(sels[1].dependencies)) + self.assertEqual(1, len(sels[1].dependencies)) dep = sels[1].dependencies[0] - self.assertEquals('http://foo/Compiler.xml', dep.interface) - self.assertEquals(3, len(dep.bindings)) - self.assertEquals('bin', dep.bindings[0].insert) - self.assertEquals('PATH', dep.bindings[0].name) - self.assertEquals('prepend', dep.bindings[0].mode) + self.assertEqual('http://foo/Compiler.xml', dep.interface) + self.assertEqual(3, len(dep.bindings)) + self.assertEqual('bin', dep.bindings[0].insert) + self.assertEqual('PATH', dep.bindings[0].name) + self.assertEqual('prepend', dep.bindings[0].mode) assert dep.bindings[0].separator in ';:' - self.assertEquals('bin', dep.bindings[1].value) - self.assertEquals('NO_PATH', dep.bindings[1].name) - self.assertEquals(',', dep.bindings[1].separator) + self.assertEqual('bin', dep.bindings[1].value) + self.assertEqual('NO_PATH', dep.bindings[1].name) + self.assertEqual(',', dep.bindings[1].separator) - self.assertEquals('bin', dep.bindings[2].insert) - self.assertEquals('BINDIR', dep.bindings[2].name) - self.assertEquals('replace', dep.bindings[2].mode) + self.assertEqual('bin', dep.bindings[2].insert) + self.assertEqual('BINDIR', dep.bindings[2].name) + self.assertEqual('replace', dep.bindings[2].mode) - self.assertEquals(["sha1=345"], sels[0].digests) + self.assertEqual(["sha1=345"], sels[0].digests) s1 = p.solver.selections s1.selections['http://foo/Source.xml'].attrs['http://namespace foo'] = 'bar' @@ -76,7 +76,7 @@ class TestSelections(BaseTest): xml = s1.toDOM().toxml("utf-8") root = qdom.parse(StringIO(xml)) - self.assertEquals(namespaces.XMLNS_IFACE, root.uri) + self.assertEqual(namespaces.XMLNS_IFACE, root.uri) s2 = selections.Selections(root) assertSel(s2) @@ -162,17 +162,17 @@ class TestSelections(BaseTest): command_feed = os.path.join(mydir, 'old-selections.xml') with open(command_feed) as stream: s1 = selections.Selections(qdom.parse(stream)) - self.assertEquals("run", s1.command) - self.assertEquals(2, len(s1.commands)) - self.assertEquals("bin/java", s1.commands[1].path) + self.assertEqual("run", s1.command) + self.assertEqual(2, len(s1.commands)) + self.assertEqual("bin/java", s1.commands[1].path) xml = s1.toDOM().toxml("utf-8") root = qdom.parse(StringIO(xml)) s2 = selections.Selections(root) - self.assertEquals("run", s2.command) - self.assertEquals(2, len(s2.commands)) - self.assertEquals("bin/java", s2.commands[1].path) + self.assertEqual("run", s2.command) + self.assertEqual(2, len(s2.commands)) + self.assertEqual("bin/java", s2.commands[1].path) if __name__ == '__main__': diff --git a/tests/testsolver.py b/tests/testsolver.py index a192ec2..fec0a81 100755 --- a/tests/testsolver.py +++ b/tests/testsolver.py @@ -75,7 +75,7 @@ class TestSolver(BaseTest): compiler_impls = iface_cache.get_feed(compiler.uri).implementations assert len(s.details) == 2 - self.assertEquals([(foo_src_impls['sha1=234'], None), + self.assertEqual([(foo_src_impls['sha1=234'], None), (foo_impls['sha1=123'], 'Unsupported machine type')], sorted(s.details[foo])) assert s.details[compiler] == [(compiler_impls['sha1=345'], None)] @@ -127,11 +127,11 @@ class TestSolver(BaseTest): def testArch(self): host_arch = arch.get_host_architecture() host_arch2 = arch.get_architecture(None, None) - self.assertEquals(host_arch.os_ranks, host_arch2.os_ranks) - self.assertEquals(host_arch.machine_ranks, host_arch2.machine_ranks) + self.assertEqual(host_arch.os_ranks, host_arch2.os_ranks) + self.assertEqual(host_arch.machine_ranks, host_arch2.machine_ranks) other = arch.get_architecture('FooBar', 'i486') - self.assertEquals(2, len(other.os_ranks)) + self.assertEqual(2, len(other.os_ranks)) assert 'FooBar' in other.os_ranks assert None in other.os_ranks @@ -153,7 +153,7 @@ class TestSolver(BaseTest): impl = s.selections[iface] selected.append(impl.get_version() + ' ' + impl.arch) impl.arch = 'Foo-odd' # prevent reselection - self.assertEquals([ + self.assertEqual([ '0.2 Linux-i386', # poor arch, but newest version '0.1 Linux-x86_64', # 64-bit is best match for host arch '0.1 Linux-i686', '0.1 Linux-i586', '0.1 Linux-i486'], # ordering of x86 versions @@ -172,39 +172,39 @@ class TestSolver(BaseTest): binary_arch = arch.get_architecture(None, 'arch_1') s.solve('http://foo/Langs.xml', binary_arch) assert s.ready - self.assertEquals('sha1=1', s.selections[iface].id) + self.assertEqual('sha1=1', s.selections[iface].id) # 6 is the newest, and close enough, even though not # quite the right locale binary_arch = arch.get_architecture(None, 'arch_2') s.solve('http://foo/Langs.xml', binary_arch) assert s.ready - self.assertEquals('sha1=6', s.selections[iface].id) + self.assertEqual('sha1=6', s.selections[iface].id) # 9 is the newest, although 7 is a closer match binary_arch = arch.get_architecture(None, 'arch_3') s.solve('http://foo/Langs.xml', binary_arch) assert s.ready - self.assertEquals('sha1=9', s.selections[iface].id) + self.assertEqual('sha1=9', s.selections[iface].id) # 11 is the newest we understand binary_arch = arch.get_architecture(None, 'arch_4') s.solve('http://foo/Langs.xml', binary_arch) assert s.ready - self.assertEquals('sha1=11', s.selections[iface].id) + self.assertEqual('sha1=11', s.selections[iface].id) # 13 is the newest we understand binary_arch = arch.get_architecture(None, 'arch_5') s.solve('http://foo/Langs.xml', binary_arch) assert s.ready - self.assertEquals('sha1=13', s.selections[iface].id) + self.assertEqual('sha1=13', s.selections[iface].id) def check(target_arch, langs, expected): s.langs = langs binary_arch = arch.get_architecture(None, target_arch) s.solve('http://foo/Langs.xml', binary_arch) assert s.ready - self.assertEquals(expected, s.selections[iface].id) + self.assertEqual(expected, s.selections[iface].id) # We don't understand any, so pick the newest check('arch_2', ['es_ES'], 'sha1=6') diff --git a/tests/teststore.py b/tests/teststore.py index 90e44f7..2365f89 100755 --- a/tests/teststore.py +++ b/tests/teststore.py @@ -36,11 +36,11 @@ class TestStore(BaseTest): def testInit(self): assert os.path.isdir(self.store.dir) - self.assertEquals([], os.listdir(self.store.dir)) + self.assertEqual([], os.listdir(self.store.dir)) def testEmptyManifest(self): lines = list(manifest.generate_manifest(self.tmp)) - self.assertEquals([], lines) + self.assertEqual([], lines) def testSimpleManifest(self): path = os.path.join(self.tmp, 'MyFile') @@ -49,14 +49,14 @@ class TestStore(BaseTest): f.close() os.utime(path, (1, 2)) lines = list(manifest.generate_manifest(self.tmp)) - self.assertEquals(['F f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 2 5 MyFile'], + self.assertEqual(['F f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 2 5 MyFile'], lines) def testLinkManifest(self): path = os.path.join(self.tmp, 'MyLink') os.symlink('Hello', path) lines = list(manifest.generate_manifest(self.tmp)) - self.assertEquals(['S f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 5 MyLink'], + self.assertEqual(['S f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 5 MyLink'], lines) def testVerify(self): @@ -69,7 +69,7 @@ class TestStore(BaseTest): added_digest = alg.getID(manifest.add_manifest_file(self.tmp, alg)) digest = alg.new_digest() digest.update('Hello') - self.assertEquals("S %s 5 MyLink\n" % digest.hexdigest(), + self.assertEqual("S %s 5 MyLink\n" % digest.hexdigest(), open(mfile, 'rb').read()) manifest.verify(self.tmp, added_digest) os.chmod(self.tmp, 0o700) @@ -265,7 +265,7 @@ class TestStore(BaseTest): self.populate_sample(source) lines = list(sha1new.generate_manifest(source)) - self.assertEquals(['F f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 2 5 MyFile', + self.assertEqual(['F f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 2 5 MyFile', 'S 570b0ce957ab43e774c82fca0ea3873fc452278b 19 a symlink', 'D /My Dir', 'F 0236ef92e1e37c57f0eb161e7e2f8b6a8face705 2 10 !a file!', @@ -308,7 +308,7 @@ class TestStore(BaseTest): cli.do_copy([source, copy]) - self.assertEquals('Hello', open(os.path.join(copy, digest, 'MyFile')).read()) + self.assertEqual('Hello', open(os.path.join(copy, digest, 'MyFile')).read()) finally: support.ro_rmtree(copy) diff --git a/tests/testtrust.py b/tests/testtrust.py index 63868dd..b341d63 100755 --- a/tests/testtrust.py +++ b/tests/testtrust.py @@ -35,9 +35,9 @@ class TestTrust(BaseTest): def testAddDomain(self): assert not trust.trust_db.is_trusted("1234", "0install.net") trust.trust_db.trust_key("1234") - self.assertEquals(set(['*']), trust.trust_db.get_trust_domains("1234")) - self.assertEquals(set(['1234']), trust.trust_db.get_keys_for_domain("*")) - self.assertEquals(set(), trust.trust_db.get_trust_domains("bob")) + self.assertEqual(set(['*']), trust.trust_db.get_trust_domains("1234")) + self.assertEqual(set(['1234']), trust.trust_db.get_keys_for_domain("*")) + self.assertEqual(set(), trust.trust_db.get_trust_domains("bob")) assert trust.trust_db.is_trusted("1234") assert trust.trust_db.is_trusted("1234", "0install.net") @@ -56,11 +56,11 @@ class TestTrust(BaseTest): assert trust.trust_db.is_trusted("1234", "gimp.org") assert not trust.trust_db.is_trusted("1234", "rox.sourceforge.net") - self.assertEquals(set(['1234', '1236']), + self.assertEqual(set(['1234', '1236']), trust.trust_db.get_keys_for_domain("gimp.org")) - self.assertEquals(set(), trust.trust_db.get_trust_domains("99877")) - self.assertEquals(set(['0install.net', 'gimp.org']), trust.trust_db.get_trust_domains("1234")) + self.assertEqual(set(), trust.trust_db.get_trust_domains("99877")) + self.assertEqual(set(['0install.net', 'gimp.org']), trust.trust_db.get_trust_domains("1234")) def testParallel(self): a = trust.TrustDB() @@ -73,7 +73,7 @@ class TestTrust(BaseTest): assert a.is_trusted("2") def testDomain(self): - self.assertEquals("example.com", trust.domain_from_url('http://example.com/foo')) + self.assertEqual("example.com", trust.domain_from_url('http://example.com/foo')) self.assertRaises(SafeException, lambda: trust.domain_from_url('/tmp/feed.xml')) self.assertRaises(SafeException, lambda: trust.domain_from_url('http:///foo')) self.assertRaises(SafeException, lambda: trust.domain_from_url('http://*/foo')) diff --git a/tests/testunpack.py b/tests/testunpack.py index 872894a..85dbb69 100755 --- a/tests/testunpack.py +++ b/tests/testunpack.py @@ -140,7 +140,7 @@ class AbstractTestUnpack(): alg_name = required.split('=', 1)[0] manifest.fixup_permissions(self.tmpdir) sha1 = alg_name + '=' + manifest.add_manifest_file(self.tmpdir, manifest.get_algorithm(alg_name)).hexdigest() - self.assertEquals(sha1, required) + self.assertEqual(sha1, required) # Check permissions are sensible for root, dirs, files in os.walk(self.tmpdir): @@ -148,7 +148,7 @@ class AbstractTestUnpack(): full = os.path.join(root, f) if os.path.islink(full): continue full_mode = os.stat(full).st_mode - self.assertEquals(0o444, full_mode & 0o666) # Must be r-?r-?r-? + self.assertEqual(0o444, full_mode & 0o666) # Must be r-?r-?r-? class TestUnpackPython(AbstractTestUnpack, BaseTest): def setUp(self): diff --git a/tests/testwriter.py b/tests/testwriter.py index 855f009..c125c42 100755 --- a/tests/testwriter.py +++ b/tests/testwriter.py @@ -26,30 +26,30 @@ class TestWriter(BaseTest): writer.save_feed(main_feed) iface = model.Interface('http://test/test') - self.assertEquals(None, iface.stability_policy) + self.assertEqual(None, iface.stability_policy) main_feed = model.ZeroInstallFeed(test_feed, local_path = '/Hello') self.config.iface_cache._feeds[iface.uri] = main_feed reader.update_user_overrides(iface) reader.update_user_feed_overrides(main_feed) - self.assertEquals(model.developer, iface.stability_policy) - self.assertEquals(100, main_feed.last_checked) - self.assertEquals("[]", str(iface.extra_feeds)) + self.assertEqual(model.developer, iface.stability_policy) + self.assertEqual(100, main_feed.last_checked) + self.assertEqual("[]", str(iface.extra_feeds)) feed = iface.extra_feeds[0] - self.assertEquals('http://user-feed', feed.uri) - self.assertEquals('Linux', feed.os) - self.assertEquals(None, feed.machine) + self.assertEqual('http://user-feed', feed.uri) + self.assertEqual('Linux', feed.os) + self.assertEqual(None, feed.machine) def testStoreNothing(self): iface = model.Interface('http://test/test') writer.save_interface(iface) iface = model.Interface('http://test/test') - self.assertEquals(None, iface.stability_policy) + self.assertEqual(None, iface.stability_policy) reader.update_user_overrides(iface) feed = self.config.iface_cache.get_feed(iface.uri) - self.assertEquals(None, feed) + self.assertEqual(None, feed) def testStoreStability(self): main_feed = reader.load_feed('Hello.xml', local = True) @@ -60,10 +60,10 @@ class TestWriter(BaseTest): # Rating now visible main_feed = reader.load_feed('Hello.xml', local = True) reader.update_user_feed_overrides(main_feed) - self.assertEquals(1, len(main_feed.implementations)) + self.assertEqual(1, len(main_feed.implementations)) impl = main_feed.implementations['sha1=3ce644dc725f1d21cfcf02562c76f375944b266a'] - self.assertEquals(model.developer, impl.user_stability) + self.assertEqual(model.developer, impl.user_stability) if __name__ == '__main__': unittest.main() -- 2.11.4.GIT