summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2017-12-15 10:01:27 -0500
committerXavier Claessens <xavier.claessens@collabora.com>2018-03-27 15:22:29 -0400
commit029a2a8d3b7e2024941792ac94d03d5dcb55a406 (patch)
treee7ac7296ef9776680407626b9ec663ac9979b482 /test
parent3c9de69112c8158877e4b0060ef0ab89c083f376 (diff)
python3: Run 2to3 script to conver the whole codebase
This is only the raw output of the script, no manual editing. The code is now python3 only. https://bugzilla.gnome.org/show_bug.cgi?id=733067
Diffstat (limited to 'test')
-rw-r--r--test/test_cerbero_build_build.py16
-rw-r--r--test/test_cerbero_build_cookbook.py40
-rw-r--r--test/test_cerbero_build_filesprovider.py22
-rw-r--r--test/test_cerbero_build_recipe.py54
-rw-r--r--test/test_cerbero_config.py36
-rw-r--r--test/test_cerbero_ide_pkgconfig.py26
-rw-r--r--test/test_cerbero_ide_xcode_xcconfig.py4
-rw-r--r--test/test_cerbero_packages_disttarball.py14
-rw-r--r--test/test_cerbero_packages_linux.py42
-rw-r--r--test/test_cerbero_packages_osx_info_plist.py12
-rw-r--r--test/test_cerbero_packages_package.py50
-rw-r--r--test/test_cerbero_packages_packagemaker.py6
-rw-r--r--test/test_cerbero_packages_packagesstore.py26
-rw-r--r--test/test_cerbero_packages_pmdoc.py42
-rw-r--r--test/test_cerbero_packages_wix.py36
-rw-r--r--test/test_cerbero_tools_osxuniversalgenerator.py8
-rw-r--r--test/test_common.py4
17 files changed, 218 insertions, 220 deletions
diff --git a/test/test_cerbero_build_build.py b/test/test_cerbero_build_build.py
index c8406aed..941addf0 100644
--- a/test/test_cerbero_build_build.py
+++ b/test/test_cerbero_build_build.py
@@ -55,27 +55,27 @@ class ModifyEnvTest(unittest.TestCase):
os.environ[self.var] = self.val1
self.mk.append_env = {self.var: self.val2}
val = self.mk.get_env_var(self.var)
- self.assertEquals(val, "%s %s" % (self.val1, self.val2))
+ self.assertEqual(val, "%s %s" % (self.val1, self.val2))
def testAppendNonExistentEnv(self):
if self.var in os.environ:
del os.environ[self.var]
self.mk.append_env = {self.var: self.val2}
val = self.mk.get_env_var(self.var)
- self.assertEquals(val, ' %s' % self.val2)
+ self.assertEqual(val, ' %s' % self.val2)
def testNewEnv(self):
os.environ[self.var] = self.val1
self.mk.new_env = {self.var: self.val2}
val = self.mk.get_env_var(self.var)
- self.assertEquals(val, self.val2)
+ self.assertEqual(val, self.val2)
def testAppendAndNewEnv(self):
os.environ[self.var] = ''
self.mk.append_env = {self.var: self.val1}
self.mk.new_env = {self.var: self.val2}
val = self.mk.get_env_var(self.var)
- self.assertEquals(val, self.val2)
+ self.assertEqual(val, self.val2)
def testSystemLibs(self):
os.environ['PKG_CONFIG_PATH'] = '/path/1'
@@ -83,15 +83,15 @@ class ModifyEnvTest(unittest.TestCase):
self.mk.config.allow_system_libs = True
self.mk.use_system_libs = True
val = self.mk.get_env_var('PKG_CONFIG_PATH')
- self.assertEquals(val,'/path/2:/usr/lib/pkgconfig:'
+ self.assertEqual(val,'/path/2:/usr/lib/pkgconfig:'
'/usr/share/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig')
val = self.mk.get_env_var('PKG_CONFIG_LIBDIR')
- self.assertEquals(val,'/path/2')
+ self.assertEqual(val,'/path/2')
def testNestedModif(self):
os.environ[self.var] = self.val1
self.mk.append_env = {self.var: self.val2}
val = self.mk.get_env_var(self.var)
- self.assertEquals(val, "%s %s" % (self.val1, self.val2))
+ self.assertEqual(val, "%s %s" % (self.val1, self.val2))
val = self.mk.get_env_var_nested(self.var)
- self.assertEquals(val, "%s %s" % (self.val1, self.val2))
+ self.assertEqual(val, "%s %s" % (self.val1, self.val2))
diff --git a/test/test_cerbero_build_cookbook.py b/test/test_cerbero_build_cookbook.py
index 80b9f9e9..6fe6d601 100644
--- a/test/test_cerbero_build_cookbook.py
+++ b/test/test_cerbero_build_cookbook.py
@@ -34,7 +34,7 @@ class PackageTest(unittest.TestCase):
self.cookbook = CookBook(self.config, False)
def testSetGetConfig(self):
- self.assertEquals(self.config, self.cookbook.get_config())
+ self.assertEqual(self.config, self.cookbook.get_config())
self.cookbook.set_config(None)
self.assertIsNone(self.cookbook._config)
@@ -42,7 +42,7 @@ class PackageTest(unittest.TestCase):
status = {'test': 'test'}
self.cookbook.set_status(status)
self.cookbook._restore_cache()
- self.assertEquals(self.cookbook.status, {})
+ self.assertEqual(self.cookbook.status, {})
def testSaveCache(self):
tmp = tempfile.NamedTemporaryFile()
@@ -52,7 +52,7 @@ class PackageTest(unittest.TestCase):
self.cookbook.save()
with open(self.cookbook._cache_file(self.config), 'rb') as f:
loaded_status = pickle.load(f)
- self.assertEquals(status, loaded_status)
+ self.assertEqual(status, loaded_status)
def testLoad(self):
tmp = tempfile.NamedTemporaryFile()
@@ -61,30 +61,30 @@ class PackageTest(unittest.TestCase):
with open(tmp.name, 'wb') as f:
pickle.dump(status, f)
self.cookbook._restore_cache()
- self.assertEquals(status, self.cookbook.status)
+ self.assertEqual(status, self.cookbook.status)
def testAddGetRecipe(self):
recipe = Recipe1(self.config)
- self.failUnlessRaises(RecipeNotFoundError, self.cookbook.get_recipe,
+ self.assertRaises(RecipeNotFoundError, self.cookbook.get_recipe,
recipe.name)
self.cookbook.add_recipe(recipe)
- self.assertEquals(recipe, self.cookbook.recipes[recipe.name])
- self.assertEquals(recipe, self.cookbook.get_recipe(recipe.name))
- self.assertEquals(self.cookbook.get_recipes_list(), [recipe])
+ self.assertEqual(recipe, self.cookbook.recipes[recipe.name])
+ self.assertEqual(recipe, self.cookbook.get_recipe(recipe.name))
+ self.assertEqual(self.cookbook.get_recipes_list(), [recipe])
def testGetRecipesStatus(self):
recipe = Recipe1(self.config)
self.cookbook._restore_cache()
- self.assertEquals(self.cookbook.status, {})
+ self.assertEqual(self.cookbook.status, {})
self.cookbook.add_recipe(recipe)
- self.assertEquals(len(self.cookbook.status), 0)
+ self.assertEqual(len(self.cookbook.status), 0)
status = self.cookbook._recipe_status(recipe.name)
- self.assertEquals(len(self.cookbook.status), 1)
- self.assertEquals(status.steps, [])
+ self.assertEqual(len(self.cookbook.status), 1)
+ self.assertEqual(status.steps, [])
status.steps.append('1')
status = self.cookbook._recipe_status(recipe.name)
- self.assertEquals(len(self.cookbook.status), 1)
- self.assertEquals(status.steps[0], '1')
+ self.assertEqual(len(self.cookbook.status), 1)
+ self.assertEqual(status.steps[0], '1')
def testUpdateStatus(self):
recipe = Recipe1(self.config)
@@ -92,13 +92,13 @@ class PackageTest(unittest.TestCase):
self.cookbook._restore_cache()
self.cookbook.update_step_status(recipe.name, 'fetch')
status = self.cookbook._recipe_status(recipe.name)
- self.assertEquals(status.steps, ['fetch'])
+ self.assertEqual(status.steps, ['fetch'])
self.cookbook.update_step_status(recipe.name, 'build')
status = self.cookbook._recipe_status(recipe.name)
- self.assertEquals(status.steps, ['fetch', 'build'])
+ self.assertEqual(status.steps, ['fetch', 'build'])
self.cookbook.update_step_status(recipe.name, 'install')
status = self.cookbook._recipe_status(recipe.name)
- self.assertEquals(status.steps, ['fetch', 'build', 'install'])
+ self.assertEqual(status.steps, ['fetch', 'build', 'install'])
for step in ['fetch', 'build', 'install']:
self.assertTrue(self.cookbook.step_done(recipe.name, step))
@@ -108,10 +108,10 @@ class PackageTest(unittest.TestCase):
self.cookbook._restore_cache()
self.cookbook.update_build_status(recipe.name, '1.0')
self.assertTrue(self.cookbook.status[recipe.name].needs_build)
- self.assertEquals(self.cookbook.status[recipe.name].built_version, '1.0')
+ self.assertEqual(self.cookbook.status[recipe.name].built_version, '1.0')
self.cookbook.update_build_status(recipe.name, None)
self.assertFalse(self.cookbook.status[recipe.name].needs_build)
- self.assertEquals(self.cookbook.status[recipe.name].built_version, None)
+ self.assertEqual(self.cookbook.status[recipe.name].built_version, None)
def testResetRecipeStatus(self):
recipe = Recipe1(self.config)
@@ -119,5 +119,5 @@ class PackageTest(unittest.TestCase):
self.cookbook._restore_cache()
self.cookbook.reset_recipe_status(recipe.name)
status = self.cookbook._recipe_status(recipe.name)
- self.assertEquals(status.steps, [])
+ self.assertEqual(status.steps, [])
self.assertTrue(self.cookbook.status[recipe.name].needs_build)
diff --git a/test/test_cerbero_build_filesprovider.py b/test/test_cerbero_build_filesprovider.py
index 7e0814d8..fdd36d5a 100644
--- a/test/test_cerbero_build_filesprovider.py
+++ b/test/test_cerbero_build_filesprovider.py
@@ -79,39 +79,39 @@ class PackageTest(unittest.TestCase):
shutil.rmtree(self.tmp)
def testFilesCategories(self):
- self.assertEquals(sorted(['bins', 'libs', 'misc', 'devel']),
+ self.assertEqual(sorted(['bins', 'libs', 'misc', 'devel']),
self.win32recipe._files_categories())
def testListBinaries(self):
- self.assertEquals(self.win32recipe.files_list_by_category('bins'),
+ self.assertEqual(self.win32recipe.files_list_by_category('bins'),
sorted(self.winbin))
- self.assertEquals(self.linuxrecipe.files_list_by_category('bins'),
+ self.assertEqual(self.linuxrecipe.files_list_by_category('bins'),
sorted(self.linuxbin))
def testListLibraries(self):
add_files(self.tmp)
- self.assertEquals(self.win32recipe.files_list_by_category('libs'),
+ self.assertEqual(self.win32recipe.files_list_by_category('libs'),
sorted(self.winlib))
- self.assertEquals(self.linuxrecipe.files_list_by_category('libs'),
+ self.assertEqual(self.linuxrecipe.files_list_by_category('libs'),
sorted(self.linuxlib))
def testDevelFiles(self):
add_files(self.tmp)
- self.assertEquals(self.win32recipe.devel_files_list(),
+ self.assertEqual(self.win32recipe.devel_files_list(),
sorted(self.windevfiles))
- self.assertEquals(self.linuxrecipe.devel_files_list(),
+ self.assertEqual(self.linuxrecipe.devel_files_list(),
sorted(self.lindevfiles))
def testDistFiles(self):
win32files = self.winlib + self.winbin + self.winmisc
linuxfiles = self.linuxlib + self.linuxbin + self.linuxmisc
add_files(self.tmp)
- self.assertEquals(self.win32recipe.dist_files_list(), sorted(win32files))
- self.assertEquals(self.linuxrecipe.dist_files_list(), sorted(linuxfiles))
+ self.assertEqual(self.win32recipe.dist_files_list(), sorted(win32files))
+ self.assertEqual(self.linuxrecipe.dist_files_list(), sorted(linuxfiles))
def testGetAllFiles(self):
win32files = self.winlib + self.winbin + self.winmisc + self.windevfiles
linuxfiles = self.linuxlib + self.linuxbin + self.linuxmisc + self.lindevfiles
add_files(self.tmp)
- self.assertEquals(self.win32recipe.files_list(), sorted(win32files))
- self.assertEquals(self.linuxrecipe.files_list(), sorted(linuxfiles))
+ self.assertEqual(self.win32recipe.files_list(), sorted(win32files))
+ self.assertEqual(self.linuxrecipe.files_list(), sorted(linuxfiles))
diff --git a/test/test_cerbero_build_recipe.py b/test/test_cerbero_build_recipe.py
index 78d31bb1..2b2a643c 100644
--- a/test/test_cerbero_build_recipe.py
+++ b/test/test_cerbero_build_recipe.py
@@ -62,9 +62,7 @@ class Recipe(recipe.Recipe):
platform_licenses_test = {Platform.LINUX: [License.BSD]}
-class Class3(object):
-
- __metaclass__ = recipe.MetaUniversalRecipe
+class Class3(object, metaclass=recipe.MetaUniversalRecipe):
def _do_step(self, name):
return name
@@ -92,12 +90,12 @@ class TestReceiptMetaClass(unittest.TestCase):
def testFunctions(self):
self.assertTrue(hasattr(self.t, 'class1_method'))
self.assertTrue(hasattr(self.t, 'class2_method'))
- self.assertEquals(self.t.fetch(), 'CODEPASS')
- self.assertEquals(self.t.compile(), 'CODEPASS')
- self.assertEquals(self.t.post_install(), 'CODEPASS')
+ self.assertEqual(self.t.fetch(), 'CODEPASS')
+ self.assertEqual(self.t.compile(), 'CODEPASS')
+ self.assertEqual(self.t.post_install(), 'CODEPASS')
def testSubclassesInit(self):
- self.assertEquals(self.t.test, 'CODEPASS')
+ self.assertEqual(self.t.test, 'CODEPASS')
class TestReceipt(unittest.TestCase):
@@ -114,14 +112,14 @@ class TestReceipt(unittest.TestCase):
build_dir = os.path.join(self.config.sources, self.recipe.package_name)
build_dir = os.path.abspath(build_dir)
- self.assertEquals(self.recipe.repo_dir, repo_dir)
- self.assertEquals(self.recipe.build_dir, build_dir)
+ self.assertEqual(self.recipe.repo_dir, repo_dir)
+ self.assertEqual(self.recipe.build_dir, build_dir)
def testListDeps(self):
self.recipe.config.target_platform = Platform.LINUX
- self.assertEquals(['dep1', 'dep2', 'dep3'], self.recipe.list_deps())
+ self.assertEqual(['dep1', 'dep2', 'dep3'], self.recipe.list_deps())
self.recipe.config.target_platform = Platform.WINDOWS
- self.assertEquals(['dep1', 'dep2', 'dep4'], self.recipe.list_deps())
+ self.assertEqual(['dep1', 'dep2', 'dep4'], self.recipe.list_deps())
def testRemoveSteps(self):
self.recipe._remove_steps(['donotexits'])
@@ -141,20 +139,20 @@ class TestLicenses(unittest.TestCase):
self.recipe = Recipe(self.config)
def testLicenses(self):
- self.assertEquals(self.recipe.licenses, [License.LGPL])
+ self.assertEqual(self.recipe.licenses, [License.LGPL])
licenses_libs = self.recipe.list_licenses_by_categories(['libs'])
- self.assertEquals(licenses_libs['libs'], [License.LGPL])
- self.assertEquals(licenses_libs.values(), [[License.LGPL]])
+ self.assertEqual(licenses_libs['libs'], [License.LGPL])
+ self.assertEqual(list(licenses_libs.values()), [[License.LGPL]])
licenses_bins = self.recipe.list_licenses_by_categories(['bins'])
- self.assertEquals(licenses_bins['bins'], [License.GPL])
- self.assertEquals(licenses_bins.values(), [[License.GPL]])
+ self.assertEqual(licenses_bins['bins'], [License.GPL])
+ self.assertEqual(list(licenses_bins.values()), [[License.GPL]])
self.recipe.platform = Platform.LINUX
self.recipe.config.target_platform = Platform.LINUX
licenses_test = self.recipe.list_licenses_by_categories(['test'])
- self.assertEquals(licenses_test['test'], [License.BSD])
- self.assertEquals(licenses_test.values(), [[License.BSD]])
+ self.assertEqual(licenses_test['test'], [License.BSD])
+ self.assertEqual(list(licenses_test.values()), [[License.BSD]])
class TestMetaUniveralRecipe(unittest.TestCase):
@@ -164,7 +162,7 @@ class TestMetaUniveralRecipe(unittest.TestCase):
for _, step in recipe.BuildSteps():
self.assertTrue(hasattr(obj, step))
stepfunc = getattr(obj, step)
- self.assertEquals(stepfunc(), step)
+ self.assertEqual(stepfunc(), step)
class TestUniversalRecipe(unittest.TestCase):
@@ -186,30 +184,30 @@ class TestUniversalRecipe(unittest.TestCase):
self.assertTrue(self.recipe.is_empty())
def testProxyEmpty(self):
- self.failUnlessRaises(AttributeError, getattr, self.recipe, 'name')
+ self.assertRaises(AttributeError, getattr, self.recipe, 'name')
def testProxyRecipe(self):
self.recipe.add_recipe(self.recipe_x86)
- self.assertEquals(self.recipe.name, self.recipe_x86.name)
- self.assertEquals(self.recipe.licence, self.recipe_x86.licence)
- self.assertEquals(self.recipe.uuid, self.recipe_x86.uuid)
+ self.assertEqual(self.recipe.name, self.recipe_x86.name)
+ self.assertEqual(self.recipe.licence, self.recipe_x86.licence)
+ self.assertEqual(self.recipe.uuid, self.recipe_x86.uuid)
def testAddRecipe(self):
self.recipe.add_recipe(self.recipe_x86)
- self.assertEquals(self.recipe._recipes[Architecture.X86],
+ self.assertEqual(self.recipe._recipes[Architecture.X86],
self.recipe_x86)
- self.assertEquals(self.recipe._proxy_recipe,
+ self.assertEqual(self.recipe._proxy_recipe,
self.recipe_x86)
def testDifferentRecipe(self):
self.recipe.add_recipe(self.recipe_x86)
recipe_test = Recipe1(self.config_x86)
recipe_test.name = 'noname'
- self.failUnlessRaises(FatalError, self.recipe.add_recipe, recipe_test)
+ self.assertRaises(FatalError, self.recipe.add_recipe, recipe_test)
def testSteps(self):
- self.assertEquals(self.recipe.steps, [])
+ self.assertEqual(self.recipe.steps, [])
self.recipe.add_recipe(self.recipe_x86)
self.recipe.add_recipe(self.recipe_x86_64)
- self.assertEquals(self.recipe.steps,
+ self.assertEqual(self.recipe.steps,
recipe.BuildSteps() + [recipe.BuildSteps.MERGE])
diff --git a/test/test_cerbero_config.py b/test/test_cerbero_config.py
index 8baf0edb..f4465f83 100644
--- a/test/test_cerbero_config.py
+++ b/test/test_cerbero_config.py
@@ -39,7 +39,7 @@ class LinuxPackagesTest(unittest.TestCase):
f.write('%s="test"\n' % p)
func()
for p in properties:
- self.assertEquals(getattr(config, p), 'test')
+ self.assertEqual(getattr(config, p), 'test')
def testAllPropsInitializedNone(self):
config = Config()
@@ -92,9 +92,9 @@ class LinuxPackagesTest(unittest.TestCase):
'force_git_commit': None,
'universal_archs': [cconfig.Architecture.X86, cconfig.Architecture.X86_64],
}
- self.assertEquals(sorted(config._properties), sorted(props.keys()))
- for p, v in props.iteritems():
- self.assertEquals(getattr(config, p), v)
+ self.assertEqual(sorted(config._properties), sorted(props.keys()))
+ for p, v in props.items():
+ self.assertEqual(getattr(config, p), v)
def testLoadMainConfig(self):
config = Config()
@@ -126,7 +126,7 @@ class LinuxPackagesTest(unittest.TestCase):
config = Config()
del os.environ[cconfig.CERBERO_UNINSTALLED]
config._check_uninstalled()
- self.failUnlessRaises(FatalError, config.load_defaults)
+ self.assertRaises(FatalError, config.load_defaults)
def testCheckUninstalled(self):
config = Config()
@@ -145,43 +145,43 @@ class LinuxPackagesTest(unittest.TestCase):
config.do_setup_env()
env = config.get_env(tmpdir, os.path.join(tmpdir, 'lib'),
config.py_prefix)
- for k, v in env.iteritems():
- self.assertEquals(os.environ[k], v)
+ for k, v in env.items():
+ self.assertEqual(os.environ[k], v)
def testParseBadConfigFile(self):
config = Config()
tmpfile = tempfile.NamedTemporaryFile()
with open(tmpfile.name, 'w') as f:
f.write('nonsense line')
- self.failUnlessRaises(ConfigurationError, config.parse, tmpfile.name)
+ self.assertRaises(ConfigurationError, config.parse, tmpfile.name)
def testJoinPath(self):
config = Config()
config.platform = Platform.LINUX
- self.assertEquals(config._join_path('/test1', '/test2'), '/test1:/test2')
+ self.assertEqual(config._join_path('/test1', '/test2'), '/test1:/test2')
config.platform = Platform.WINDOWS
- self.assertEquals(config._join_path('/test1', '/test2'), '/test1;/test2')
+ self.assertEqual(config._join_path('/test1', '/test2'), '/test1;/test2')
def testLoadCommandConfig(self):
config = Config()
config.filename = None
config._load_cmd_config(None)
self.assertIsNone(config.filename)
- self.failUnlessRaises(ConfigurationError, config._load_cmd_config,
+ self.assertRaises(ConfigurationError, config._load_cmd_config,
'/foo/bar')
tmpfile = tempfile.NamedTemporaryFile()
config._load_cmd_config(tmpfile.name)
- self.assertEquals(config.filename, cconfig.DEFAULT_CONFIG_FILE)
+ self.assertEqual(config.filename, cconfig.DEFAULT_CONFIG_FILE)
def testLastDefaults(self):
config = Config()
config._load_last_defaults()
cerbero_home = os.path.expanduser('~/cerbero')
- self.assertEquals(config.prefix, os.path.join(cerbero_home, 'dist'))
- self.assertEquals(config.install_dir, config.prefix)
- self.assertEquals(config.sources,
+ self.assertEqual(config.prefix, os.path.join(cerbero_home, 'dist'))
+ self.assertEqual(config.install_dir, config.prefix)
+ self.assertEqual(config.sources,
os.path.join(cerbero_home, 'sources'))
- self.assertEquals(config.local_sources,
+ self.assertEqual(config.local_sources,
os.path.join(cerbero_home, 'sources', 'local'))
def testRecipesExternalRepositories(self):
@@ -192,7 +192,7 @@ class LinuxPackagesTest(unittest.TestCase):
expected = {'default': ('test', 0),
'test1': ('/path/to/repo', 1),
'test2': ('/path/to/other/repo', 2)}
- self.assertEquals(config.get_recipes_repos(), expected)
+ self.assertEqual(config.get_recipes_repos(), expected)
def testPakcagesExternalRepositories(self):
config = Config()
@@ -202,4 +202,4 @@ class LinuxPackagesTest(unittest.TestCase):
expected = {'default': ('test', 0),
'test1': ('/path/to/repo', 1),
'test2': ('/path/to/other/repo', 2)}
- self.assertEquals(config.get_packages_repos(), expected)
+ self.assertEqual(config.get_packages_repos(), expected)
diff --git a/test/test_cerbero_ide_pkgconfig.py b/test/test_cerbero_ide_pkgconfig.py
index 4827efd7..fbcf7909 100644
--- a/test/test_cerbero_ide_pkgconfig.py
+++ b/test/test_cerbero_ide_pkgconfig.py
@@ -35,41 +35,41 @@ class TestPkgConfig(unittest.TestCase):
def testListAll(self):
expected = ['gobject-2.0', 'gmodule-2.0', 'libxml-2.0', 'gthread-2.0',
'glib-2.0', 'gmodule-no-export-2.0', 'gstreamer-0.10']
- self.assertEquals(sorted(PkgConfig.list_all()), sorted(expected))
+ self.assertEqual(sorted(PkgConfig.list_all()), sorted(expected))
def testIncludeDirs(self):
expected = ['/usr/include/gstreamer-0.10', '/usr/include/glib-2.0',
'/usr/lib/glib-2.0/include',
'/usr/include/libxml2']
- self.assertEquals(self.pkgconfig.include_dirs(), expected)
+ self.assertEqual(self.pkgconfig.include_dirs(), expected)
expected = ['/usr/include/gstreamer-0.10']
- self.assertEquals(self.pkgconfig2.include_dirs(), expected)
+ self.assertEqual(self.pkgconfig2.include_dirs(), expected)
def testCFlags(self):
expected = ['-pthread']
- self.assertEquals(self.pkgconfig.cflags(), expected)
+ self.assertEqual(self.pkgconfig.cflags(), expected)
expected = []
- self.assertEquals(self.pkgconfig2.cflags(), expected)
+ self.assertEqual(self.pkgconfig2.cflags(), expected)
def testLibrariesDir(self):
expected = []
- self.assertEquals(self.pkgconfig.libraries_dirs(), expected)
+ self.assertEqual(self.pkgconfig.libraries_dirs(), expected)
expected = []
- self.assertEquals(self.pkgconfig2.libraries_dirs(), expected)
+ self.assertEqual(self.pkgconfig2.libraries_dirs(), expected)
def testLibraries(self):
expected = ['gstreamer-0.10', 'gobject-2.0', 'gmodule-2.0', 'xml2',
'gthread-2.0', 'rt', 'glib-2.0']
- self.assertEquals(self.pkgconfig.libraries(), expected)
+ self.assertEqual(self.pkgconfig.libraries(), expected)
expected = ['gstreamer-0.10']
- self.assertEquals(self.pkgconfig2.libraries(), expected)
+ self.assertEqual(self.pkgconfig2.libraries(), expected)
def testRequires(self):
expected = ['glib-2.0', 'gobject-2.0', 'gmodule-no-export-2.0',
'gthread-2.0', 'libxml-2.0']
- self.assertEquals(self.pkgconfig.requires(), expected)
- self.assertEquals(self.pkgconfig2.requires(), expected)
+ self.assertEqual(self.pkgconfig.requires(), expected)
+ self.assertEqual(self.pkgconfig2.requires(), expected)
def testPrefix(self):
- self.assertEquals(self.pkgconfig.prefix(), '/usr')
- self.assertEquals(self.pkgconfig2.prefix(), '/usr')
+ self.assertEqual(self.pkgconfig.prefix(), '/usr')
+ self.assertEqual(self.pkgconfig2.prefix(), '/usr')
diff --git a/test/test_cerbero_ide_xcode_xcconfig.py b/test/test_cerbero_ide_xcode_xcconfig.py
index 87c76d94..5ce7d522 100644
--- a/test/test_cerbero_ide_xcode_xcconfig.py
+++ b/test/test_cerbero_ide_xcode_xcconfig.py
@@ -49,11 +49,11 @@ class TestPkgConfig(unittest.TestCase):
'/usr/lib/glib-2.0/include '
'/usr/include/libxml2',
'lsp': ''}
- self.assertEquals(expected, xcconfig._fill())
+ self.assertEqual(expected, xcconfig._fill())
def testXCConfig(self):
tmp = tempfile.NamedTemporaryFile()
xcconfig = XCConfig('gstreamer-0.10')
xcconfig.create(tmp.name)
with open(tmp.name, 'r') as f:
- self.assertEquals(f.read(), XCCONFIG)
+ self.assertEqual(f.read(), XCCONFIG)
diff --git a/test/test_cerbero_packages_disttarball.py b/test/test_cerbero_packages_disttarball.py
index b7427a2d..8db2c98d 100644
--- a/test/test_cerbero_packages_disttarball.py
+++ b/test/test_cerbero_packages_disttarball.py
@@ -44,27 +44,27 @@ class DistTarballTest(unittest.TestCase):
def testRuntimePackage(self):
# Creates one package with the runtime files
filenames = self.packager.pack(self.tmp, devel=False)
- self.assertEquals(len(filenames), 1)
+ self.assertEqual(len(filenames), 1)
tar = tarfile.open(filenames[0], "r:bz2")
tarfiles = sorted([x.path for x in tar.getmembers()])
- self.assertEquals(tarfiles, self.package.files_list())
+ self.assertEqual(tarfiles, self.package.files_list())
def testRuntimeAndDevelPackages(self):
# Creates 2 packages, one with the runtime files a second one with the
# devel files
filenames = self.packager.pack(self.tmp, devel=True)
- self.assertEquals(len(filenames), 2)
+ self.assertEqual(len(filenames), 2)
tar = tarfile.open(filenames[0], "r:bz2")
tarfiles = sorted([x.path for x in tar.getmembers()])
- self.assertEquals(tarfiles, self.package.files_list())
+ self.assertEqual(tarfiles, self.package.files_list())
tar = tarfile.open(filenames[1], "r:bz2")
tarfiles = sorted([x.path for x in tar.getmembers()])
- self.assertEquals(tarfiles, self.package.devel_files_list())
+ self.assertEqual(tarfiles, self.package.devel_files_list())
def testRuntimeWithDevelPackage(self):
# Creates 1 package, with the runtime files and the devel files
filenames = self.packager.pack(self.tmp, devel=True, split=False)
- self.assertEquals(len(filenames), 1)
+ self.assertEqual(len(filenames), 1)
tar = tarfile.open(filenames[0], "r:bz2")
tarfiles = sorted([x.path for x in tar.getmembers()])
- self.assertEquals(tarfiles, self.package.all_files_list())
+ self.assertEqual(tarfiles, self.package.all_files_list())
diff --git a/test/test_cerbero_packages_linux.py b/test/test_cerbero_packages_linux.py
index a29b0198..9ac86fca 100644
--- a/test/test_cerbero_packages_linux.py
+++ b/test/test_cerbero_packages_linux.py
@@ -71,24 +71,24 @@ class LinuxPackagesTest(unittest.TestCase):
# Test default values
package = Package1(config, None, None)
packager = linux.LinuxPackager(config, package, None)
- self.assertEquals(packager.package_prefix, '')
- self.assertEquals(packager.full_package_name, 'gstreamer-test1-1.0')
- self.assertEquals(packager.packager, DEFAULT_PACKAGER)
+ self.assertEqual(packager.package_prefix, '')
+ self.assertEqual(packager.full_package_name, 'gstreamer-test1-1.0')
+ self.assertEqual(packager.packager, DEFAULT_PACKAGER)
# Test packages_prefix and packager
config.packages_prefix = 'test'
config.packager = 'Pin <pan@p.un>'
packager = linux.LinuxPackager(config, package, None)
- self.assertEquals(packager.package_prefix, 'test-')
- self.assertEquals(packager.full_package_name,
+ self.assertEqual(packager.package_prefix, 'test-')
+ self.assertEqual(packager.full_package_name,
'test-gstreamer-test1-1.0')
- self.assertEquals(packager.packager, 'Pin <pan@p.un>')
+ self.assertEqual(packager.packager, 'Pin <pan@p.un>')
# Test ignore package
package.ignore_package_prefix = True
packager = linux.LinuxPackager(config, package, None)
- self.assertEquals(packager.package_prefix, '')
- self.assertEquals(packager.full_package_name, 'gstreamer-test1-1.0')
+ self.assertEqual(packager.package_prefix, '')
+ self.assertEqual(packager.full_package_name, 'gstreamer-test1-1.0')
def testRequires(self):
self.packager._empty_packages = []
@@ -98,25 +98,25 @@ class LinuxPackagesTest(unittest.TestCase):
'gstreamer-test1'])
requires = self.packager.get_requires(PackageType.RUNTIME, '-dev')
- self.assertEquals(expected, requires)
+ self.assertEqual(expected, requires)
# test devel packages
requires = self.packager.get_requires(PackageType.DEVEL, '-dev')
- self.assertEquals([], requires)
+ self.assertEqual([], requires)
self.store.get_package('gstreamer-test1').has_devel_package = True
requires = self.packager.get_requires(PackageType.DEVEL, '-dev')
- self.assertEquals(['gstreamer-test1-dev'], requires)
+ self.assertEqual(['gstreamer-test1-dev'], requires)
for p in expected:
self.store.get_package(p).has_devel_package = True
requires = self.packager.get_requires(PackageType.DEVEL, '-dev')
- self.assertEquals([x + '-dev' for x in expected], requires)
+ self.assertEqual([x + '-dev' for x in expected], requires)
# test empty packages
self.packager._empty_packages = \
[self.store.get_package('gstreamer-test2')]
requires = self.packager.get_requires(PackageType.RUNTIME, '-dev')
expected.remove('gstreamer-test2')
- self.assertEquals(expected, requires)
+ self.assertEqual(expected, requires)
def testMetaPackageRequires(self):
self.packager._empty_packages = []
@@ -127,16 +127,16 @@ class LinuxPackagesTest(unittest.TestCase):
self.store.get_package('gstreamer-test3').has_runtime_package = True
self.store.get_package('gstreamer-test-bindings').has_runtime_package = True
requires = self.packager.get_meta_requires(PackageType.RUNTIME, '')
- self.assertEquals(expected, requires)
+ self.assertEqual(expected, requires)
# test devel packages
requires = self.packager.get_meta_requires(PackageType.DEVEL, '-dev')
- self.assertEquals(([], [], []), requires)
+ self.assertEqual(([], [], []), requires)
# test empty packages
self.store.get_package('gstreamer-test1').has_devel_package = True
requires = self.packager.get_meta_requires(PackageType.DEVEL, '-dev')
- self.assertEquals((['gstreamer-test1-dev'], [], []), requires)
+ self.assertEqual((['gstreamer-test1-dev'], [], []), requires)
for p in [self.store.get_package(x[0]) for x in expected]:
p.has_devel_package = True
@@ -144,7 +144,7 @@ class LinuxPackagesTest(unittest.TestCase):
expected = (['gstreamer-test1-dev'],
['gstreamer-test3-dev'],
['gstreamer-test-bindings-dev'])
- self.assertEquals(expected, requires)
+ self.assertEqual(expected, requires)
def testPackDeps(self):
expected = sorted(['gstreamer-test-bindings',
@@ -158,12 +158,12 @@ class LinuxPackagesTest(unittest.TestCase):
global packed
packed = []
self.packager.pack_deps('', '', True)
- self.assertEquals(sorted(packed), expected)
+ self.assertEqual(sorted(packed), expected)
packed = []
self.packager.devel = False
self.packager.pack_deps('', '', True)
- self.assertEquals(sorted(packed), expected)
+ self.assertEqual(sorted(packed), expected)
packed = []
def testPack(self):
@@ -172,11 +172,11 @@ class LinuxPackagesTest(unittest.TestCase):
paths = self.packager.pack('', False, True, True, False, None)
self.assertTrue(os.path.exists('gstreamer-runtime-stamp'))
os.remove('gstreamer-runtime-stamp')
- self.assertEquals(paths, ['test'])
+ self.assertEqual(paths, ['test'])
self.packager = DummyPackager(self.config,
self.store.get_package('gstreamer-test1'), self.store)
paths = self.packager.pack('', False, True, True, False, None)
self.assertTrue(os.path.exists('gstreamer-test1-stamp'))
os.remove('gstreamer-test1-stamp')
- self.assertEquals(paths, ['test'])
+ self.assertEqual(paths, ['test'])
diff --git a/test/test_cerbero_packages_osx_info_plist.py b/test/test_cerbero_packages_osx_info_plist.py
index 86d1fa30..e3394853 100644
--- a/test/test_cerbero_packages_osx_info_plist.py
+++ b/test/test_cerbero_packages_osx_info_plist.py
@@ -41,27 +41,27 @@ class InfoPlistTest(unittest.TestCase):
'Test package')
def testFormatProperty(self):
- self.assertEquals('<key>Key</key>\n<string>Value</string>',
+ self.assertEqual('<key>Key</key>\n<string>Value</string>',
self.info_plist._format_property('Key', 'Value'))
def testGetPropertiesString(self):
result = self.info_plist._get_properties_string()
expected = self.PROPS_TPL % {'icon': '', 'ptype': ''}
- self.assertEquals(result, expected)
+ self.assertEqual(result, expected)
def testFrameworkPackageType(self):
self.info_plist = FrameworkPlist('test', 'test.org', '1.0',
'Test package')
result = self.info_plist._get_properties_string()
expected = self.PROPS_TPL % {'ptype': 'FMWK', 'icon': ''}
- self.assertEquals(result, expected)
+ self.assertEqual(result, expected)
def testApplicationPackageType(self):
self.info_plist = ApplicationPlist('test', 'test.org', '1.0',
'Test package')
result = self.info_plist._get_properties_string()
expected = self.PROPS_TPL % {'ptype': 'APPL', 'icon': ''}
- self.assertEquals(result, expected)
+ self.assertEqual(result, expected)
def testGetPropertiesStringWithIcon(self):
self.info_plist.icon = 'test.ico'
@@ -70,7 +70,7 @@ class InfoPlistTest(unittest.TestCase):
self.info_plist._format_property('CFBundleIconFile', 'test.ico') +
'\n'}
self.info_plist.icon = None
- self.assertEquals(result, expected)
+ self.assertEqual(result, expected)
def testSave(self):
tmp = tempfile.NamedTemporaryFile()
@@ -80,4 +80,4 @@ class InfoPlistTest(unittest.TestCase):
expected = INFO_PLIST_TPL % (self.info_plist.BEGIN,
self.info_plist._get_properties_string(),
self.info_plist.END)
- self.assertEquals(result, expected)
+ self.assertEqual(result, expected)
diff --git a/test/test_cerbero_packages_package.py b/test/test_cerbero_packages_package.py
index 7344a4a2..f4cd8839 100644
--- a/test/test_cerbero_packages_package.py
+++ b/test/test_cerbero_packages_package.py
@@ -50,23 +50,23 @@ class PackageTest(unittest.TestCase):
shutil.rmtree(self.tmp)
def testPackageMode(self):
- self.assertEquals(self.linuxpackage.name, 'gstreamer-test1')
- self.assertEquals(self.linuxpackage.shortdesc, 'GStreamer Test')
+ self.assertEqual(self.linuxpackage.name, 'gstreamer-test1')
+ self.assertEqual(self.linuxpackage.shortdesc, 'GStreamer Test')
self.linuxpackage.set_mode(PackageType.DEVEL)
- self.assertEquals(self.linuxpackage.package_mode, PackageType.DEVEL)
- self.assertEquals(self.linuxpackage.name, 'gstreamer-test1-devel')
- self.assertEquals(self.linuxpackage.shortdesc,
+ self.assertEqual(self.linuxpackage.package_mode, PackageType.DEVEL)
+ self.assertEqual(self.linuxpackage.name, 'gstreamer-test1-devel')
+ self.assertEqual(self.linuxpackage.shortdesc,
'GStreamer Test (Development Files)')
def testParseFiles(self):
- self.assertEquals(self.win32package._recipes_files['recipe1'],
+ self.assertEqual(self.win32package._recipes_files['recipe1'],
['misc', 'libs', 'bins'])
- self.assertEquals(self.win32package._recipes_files['recipe5'], ['libs'])
+ self.assertEqual(self.win32package._recipes_files['recipe5'], ['libs'])
def testListRecipesDeps(self):
- self.assertEquals(self.win32package.recipes_dependencies(),
+ self.assertEqual(self.win32package.recipes_dependencies(),
['recipe1', 'recipe5', 'recipe2'])
- self.assertEquals(self.linuxpackage.recipes_dependencies(),
+ self.assertEqual(self.linuxpackage.recipes_dependencies(),
['recipe1', 'recipe2'])
def testFilesList(self):
@@ -79,9 +79,9 @@ class PackageTest(unittest.TestCase):
'lib/libgstreamer-x11.so.1', 'lib/libgstreamer-0.10.so.1',
'libexec/gstreamer-0.10/pluginsloader', 'linux']
- self.assertEquals(sorted(winfiles),
+ self.assertEqual(sorted(winfiles),
sorted(self.win32package.files_list()))
- self.assertEquals(sorted(linuxfiles),
+ self.assertEqual(sorted(linuxfiles),
sorted(self.linuxpackage.files_list()))
def testDevelFilesList(self):
@@ -97,18 +97,18 @@ class PackageTest(unittest.TestCase):
'lib/libtest.def', 'lib/test.lib', 'lib/libgstreamer-0.10.dll.a',
'lib/libgstreamer-0.10.def', 'lib/gstreamer-0.10.lib']
- self.assertEquals(sorted(windevfiles), self.win32package.devel_files_list())
- self.assertEquals(sorted(linuxdevfiles), self.linuxpackage.devel_files_list())
+ self.assertEqual(sorted(windevfiles), self.win32package.devel_files_list())
+ self.assertEqual(sorted(linuxdevfiles), self.linuxpackage.devel_files_list())
def testSystemDependencies(self):
config = Config(self.tmp, Platform.LINUX)
config.target_distro = Distro.DEBIAN
package = Package4(config, None, None)
- self.assertEquals(package.get_sys_deps(), ['python'])
+ self.assertEqual(package.get_sys_deps(), ['python'])
config.target_distro = Distro.REDHAT
config.target_distro_version = DistroVersion.FEDORA_16
package = Package4(config, None, None)
- self.assertEquals(package.get_sys_deps(), ['python27'])
+ self.assertEqual(package.get_sys_deps(), ['python27'])
class TestMetaPackages(unittest.TestCase):
@@ -132,20 +132,20 @@ class TestMetaPackages(unittest.TestCase):
files.extend(list_func())
list_func = getattr(self.package, func_name)
- self.assertEquals(sorted(files), list_func())
+ self.assertEqual(sorted(files), list_func())
def testListPackages(self):
expected = ['gstreamer-test1', 'gstreamer-test3',
'gstreamer-test-bindings', 'gstreamer-test2']
- self.assertEquals(self.package.list_packages(), expected)
+ self.assertEqual(self.package.list_packages(), expected)
def testPlatfromPackages(self):
packages_attr = object.__getattribute__(self.package, 'packages')
- self.assertEquals(len(packages_attr), 3)
+ self.assertEqual(len(packages_attr), 3)
platform_packages_attr = object.__getattribute__(self.package,
'platform_packages')
- self.assertEquals(len(platform_packages_attr), 1)
- self.assertEquals(len(self.package.packages),
+ self.assertEqual(len(platform_packages_attr), 1)
+ self.assertEqual(len(self.package.packages),
len(packages_attr) + len(platform_packages_attr))
def testFilesList(self):
@@ -174,7 +174,7 @@ class AppPackageTest(unittest.TestCase):
self.app.embed_deps = True
expected = self.app._app_recipe.files_list()
result = self.app.files_list()
- self.assertEquals(expected, result)
+ self.assertEqual(expected, result)
def testListFilesWithEmbededDeps(self):
self.app.embed_deps = True
@@ -188,16 +188,16 @@ class AppPackageTest(unittest.TestCase):
files.extend(package.files_list())
files.extend(self.app._app_recipe.files_list())
files = sorted(set(files))
- self.assertEquals(files, self.app.files_list())
+ self.assertEqual(files, self.app.files_list())
def testListFilesWithoutEmbededDeps(self):
self.app.embed_deps = False
expected = self.app._app_recipe.files_list()
result = self.app.files_list()
- self.assertEquals(expected, result)
+ self.assertEqual(expected, result)
def testDevelFilesList(self):
- self.assertEquals(self.app.devel_files_list(), [])
+ self.assertEqual(self.app.devel_files_list(), [])
def testAllFilesList(self):
- self.assertEquals(self.app.files_list(), self.app.all_files_list())
+ self.assertEqual(self.app.files_list(), self.app.all_files_list())
diff --git a/test/test_cerbero_packages_packagemaker.py b/test/test_cerbero_packages_packagemaker.py
index 75d55f0d..9e0ce4e1 100644
--- a/test/test_cerbero_packages_packagemaker.py
+++ b/test/test_cerbero_packages_packagemaker.py
@@ -51,7 +51,7 @@ class PackageMakerTest(unittest.TestCase):
tmpdest = packager._create_bundle(files, PackageType.RUNTIME)[0]
bundlefiles = shell.check_call('find . -type f ', tmpdest).split('\n')
bundlefiles = sorted([f[2:] for f in bundlefiles])[1:]
- self.assertEquals(bundlefiles, self.files)
+ self.assertEqual(bundlefiles, self.files)
shutil.rmtree(tmpdest)
def _add_files(self):
@@ -86,7 +86,7 @@ class TestPackageMaker(unittest.TestCase):
args = {'r': 'root', 'i': 'pkg_id', 'n': 'version', 't': 'title',
'l': 'destination', 'o': 'output_file'}
cmd = pm._cmd_with_args(args)
- self.assertEquals(cmd,
+ self.assertEqual(cmd,
"./PackageMaker -i 'pkg_id' -l 'destination' -o 'output_file' "
"-n 'version' -r 'root' -t 'title'")
@@ -94,6 +94,6 @@ class TestPackageMaker(unittest.TestCase):
pm = DummyPackageMaker()
pm.create_package('root', 'pkg_id', 'version', 'title',
'output_file', 'destination')
- self.assertEquals(pm.cmd,
+ self.assertEqual(pm.cmd,
"./PackageMaker -g '10.6' -i 'pkg_id' -l 'destination' -o 'output_file' "
"-n 'version' -r 'root' -t 'title'")
diff --git a/test/test_cerbero_packages_packagesstore.py b/test/test_cerbero_packages_packagesstore.py
index 920650a9..5f932933 100644
--- a/test/test_cerbero_packages_packagesstore.py
+++ b/test/test_cerbero_packages_packagesstore.py
@@ -61,18 +61,18 @@ class PackageTest(unittest.TestCase):
def testAddPackage(self):
package = common.Package1(self.config, None, None)
- self.assertEquals(len(self.store._packages), 0)
+ self.assertEqual(len(self.store._packages), 0)
self.store.add_package(package)
- self.assertEquals(len(self.store._packages), 1)
- self.assertEquals(package, self.store._packages[package.name])
+ self.assertEqual(len(self.store._packages), 1)
+ self.assertEqual(package, self.store._packages[package.name])
def testGetPackage(self):
package = common.Package1(self.config, None, None)
self.store.add_package(package)
- self.assertEquals(package, self.store.get_package(package.name))
+ self.assertEqual(package, self.store.get_package(package.name))
def testPackageNotFound(self):
- self.failUnlessRaises(PackageNotFoundError, self.store.get_package,
+ self.assertRaises(PackageNotFoundError, self.store.get_package,
'unknown')
def testPackagesList(self):
@@ -81,21 +81,21 @@ class PackageTest(unittest.TestCase):
self.store.add_package(package)
self.store.add_package(metapackage)
l = sorted([package, metapackage], key=lambda x: x.name)
- self.assertEquals(l, self.store.get_packages_list())
+ self.assertEqual(l, self.store.get_packages_list())
def testPackageDeps(self):
package = common.Package1(self.config, None, None)
package2 = common.Package2(self.config, None, None)
self.store.add_package(package)
self.store.add_package(package2)
- self.assertEquals(package.deps,
+ self.assertEqual(package.deps,
[x.name for x in self.store.get_package_deps(package.name)])
def testMetaPackageDeps(self):
metapackage = common.MetaPackage(self.config, None)
self.store.add_package(metapackage)
# the metapackage depends on package that are not yet in the store
- self.failUnlessRaises(PackageNotFoundError,
+ self.assertRaises(PackageNotFoundError,
self.store.get_package_deps, metapackage.name)
for klass in [common.Package1, common.Package2, common.Package3,
common.Package4]:
@@ -107,7 +107,7 @@ class PackageTest(unittest.TestCase):
deps = ['gstreamer-test-bindings', 'gstreamer-test1',
'gstreamer-test2', 'gstreamer-test3']
res = [x.name for x in self.store.get_package_deps(metapackage.name)]
- self.assertEquals(sorted(deps), sorted(res))
+ self.assertEqual(sorted(deps), sorted(res))
def testLoadPackageFromFile(self):
package_file = tempfile.NamedTemporaryFile()
@@ -115,7 +115,7 @@ class PackageTest(unittest.TestCase):
package_file.flush()
p = self.store._load_package_from_file(package_file.name)
self.assertIsInstance(p, Package)
- self.assertEquals('test-package', p.name)
+ self.assertEqual('test-package', p.name)
def testLoadMetaPackageFromFile(self):
for x, t in [(SDKPACKAGE, SDKPackage),
@@ -124,9 +124,9 @@ class PackageTest(unittest.TestCase):
package_file.write(x)
package_file.flush()
p = self.store._load_package_from_file(package_file.name)
- print p, type(p)
+ print(p, type(p))
self.assertIsInstance(p, t)
- self.assertEquals('test-package', p.name)
+ self.assertEqual('test-package', p.name)
def testImports(self):
package_file = tempfile.NamedTemporaryFile()
@@ -136,5 +136,5 @@ class PackageTest(unittest.TestCase):
self.assertIsInstance(p, Package)
try:
p.test_imports()
- except ImportError, e:
+ except ImportError as e:
self.fail("Import error raised, %s", e)
diff --git a/test/test_cerbero_packages_pmdoc.py b/test/test_cerbero_packages_pmdoc.py
index daaa1d83..0694aefa 100644
--- a/test/test_cerbero_packages_pmdoc.py
+++ b/test/test_cerbero_packages_pmdoc.py
@@ -42,17 +42,17 @@ class IndexTest(unittest.TestCase, XMLMixin):
def testAddRoot(self):
self.index._add_root()
- self.assertEquals(self.index.root.tag, Index.DOCUMENT_TAG)
- self.assertEquals(self.index.root.attrib['spec'], Index.SPEC_VERSION)
- self.assertEquals(len(self.index.root.getchildren()), 0)
+ self.assertEqual(self.index.root.tag, Index.DOCUMENT_TAG)
+ self.assertEqual(self.index.root.attrib['spec'], Index.SPEC_VERSION)
+ self.assertEqual(len(self.index.root.getchildren()), 0)
def testAddProperties(self):
self.index._add_root()
self.index._add_properties()
children = self.index.root.getchildren()
- self.assertEquals(len(children), 1)
+ self.assertEqual(len(children), 1)
properties = children[0]
- self.assertEquals(len(properties.getchildren()), 6)
+ self.assertEqual(len(properties.getchildren()), 6)
self.check_text(properties, Index.TAG_ORGANIZATION, self.package.org)
self.check_text(properties, Index.TAG_TITLE, self.package.title)
self.check_text(properties, Index.TAG_BUILD,
@@ -68,7 +68,7 @@ class IndexTest(unittest.TestCase, XMLMixin):
self.index._add_root()
self.index._add_distribution()
children = self.index.root.getchildren()
- self.assertEquals(len(children), 1)
+ self.assertEqual(len(children), 1)
dist =children[0]
self.find_one(dist, Index.TAG_SCRIPTS)
self.check_attrib(dist, Index.TAG_VERSION, Index.ATTR_MIN_SPEC,
@@ -90,7 +90,7 @@ class IndexTest(unittest.TestCase, XMLMixin):
self.index._add_contents()
children = self.index.root.getchildren()
# 1 choice + 4 item
- self.assertEquals(len(children), 5)
+ self.assertEqual(len(children), 5)
contents = self.find_one(self.index.root, Index.TAG_CONTENTS)
packages =[]
@@ -107,14 +107,14 @@ class IndexTest(unittest.TestCase, XMLMixin):
self.fail("Incorrect choice %s" % choice)
elpkrefs = [x.attrib['id'] for x in \
choice.iterfind(Index.TAG_PKGREF)]
- self.assertEquals(sorted(["default.%s.%s" %
+ self.assertEqual(sorted(["default.%s.%s" %
(self.config.target_arch, x) for x in pkrefs]),
sorted(elpkrefs))
packages.extend(pkrefs)
items = [x.text[:-4] for x in self.index.root.iterfind(Index.TAG_ITEM) if
x.attrib['type']=='pkgref']
- self.assertEquals(sorted(packages), sorted(items))
+ self.assertEqual(sorted(packages), sorted(items))
class PkgRefTest(unittest.TestCase, XMLMixin):
@@ -128,10 +128,10 @@ class PkgRefTest(unittest.TestCase, XMLMixin):
def testAddRoot(self):
self.pkgref._add_root()
- self.assertEquals(self.pkgref.root.tag, PkgRef.TAG_PKGREF)
- self.assertEquals(self.pkgref.root.attrib['spec'], PkgRef.SPEC_VERSION)
- self.assertEquals(self.pkgref.root.attrib['uuid'], self.package.uuid)
- self.assertEquals(len(self.pkgref.root.getchildren()), 0)
+ self.assertEqual(self.pkgref.root.tag, PkgRef.TAG_PKGREF)
+ self.assertEqual(self.pkgref.root.attrib['spec'], PkgRef.SPEC_VERSION)
+ self.assertEqual(self.pkgref.root.attrib['uuid'], self.package.uuid)
+ self.assertEqual(len(self.pkgref.root.getchildren()), 0)
def testAddScripts(self):
self.pkgref._add_root()
@@ -170,7 +170,7 @@ class PkgRefTest(unittest.TestCase, XMLMixin):
'parent', 'installTo.isRelativeType', 'installTo',
'version', 'identifier']
docmods = [x.text for x in config.iterfind(PkgRef.TAG_MOD)]
- self.assertEquals(sorted(mods), sorted(docmods))
+ self.assertEqual(sorted(mods), sorted(docmods))
flags = self.find_one(config, PkgRef.TAG_FLAGS)
self.find_one(flags, PkgRef.TAG_FOLLOW_SYMLINKS)
@@ -204,10 +204,10 @@ class PkgContentsTest(unittest.TestCase, XMLMixin):
def testAddRoot(self):
self.pkgcontents._add_root()
- self.assertEquals(self.pkgcontents.root.tag,
+ self.assertEqual(self.pkgcontents.root.tag,
PkgContents.TAG_PKG_CONTENTS)
- self.assertEquals(self.pkgcontents.root.attrib['spec'], PkgContents.SPEC_VERSION)
- self.assertEquals(len(self.pkgcontents.root.getchildren()), 0)
+ self.assertEqual(self.pkgcontents.root.attrib['spec'], PkgContents.SPEC_VERSION)
+ self.assertEqual(len(self.pkgcontents.root.getchildren()), 0)
def testAddPackageRoot(self):
self.pkgcontents._add_root()
@@ -222,7 +222,7 @@ class PkgContentsTest(unittest.TestCase, XMLMixin):
children = [x for x in self.pkgcontents.proot.getchildren()
if x.tag == PkgContents.TAG_F]
children_path = [x.attrib['n'] for x in children]
- self.assertEquals(sorted(children_path), sorted(['bin', 'lib', 'README']))
+ self.assertEqual(sorted(children_path), sorted(['bin', 'lib', 'README']))
for c in children:
if c.attrib['n'] == 'bin':
self.check_attrib(c, PkgContents.TAG_F, 'n', 'gst-inspect')
@@ -232,9 +232,9 @@ class PkgContentsTest(unittest.TestCase, XMLMixin):
self.check_attrib(c, PkgContents.TAG_F, 'n',
'libgstplugin.so')
else:
- self.assertEquals(c.attrib['n'], 'libgstreamer.so.1.0')
+ self.assertEqual(c.attrib['n'], 'libgstreamer.so.1.0')
else:
- self.assertEquals(c.attrib['n'], 'README')
+ self.assertEqual(c.attrib['n'], 'README')
class TestPMDoc(unittest.TestCase):
@@ -269,4 +269,4 @@ class TestPMDoc(unittest.TestCase):
for p in packages:
expected_files.append("%s.xml" % p)
expected_files.append("%s-contents.xml" % p)
- self.assertEquals(sorted(files), sorted(expected_files))
+ self.assertEqual(sorted(files), sorted(expected_files))
diff --git a/test/test_cerbero_packages_wix.py b/test/test_cerbero_packages_wix.py
index e68baec1..4b0a55ba 100644
--- a/test/test_cerbero_packages_wix.py
+++ b/test/test_cerbero_packages_wix.py
@@ -17,7 +17,7 @@
# Boston, MA 02111-1307, USA.
import unittest
-import StringIO
+import io
from cerbero import hacks
from cerbero.build import recipe
@@ -97,14 +97,14 @@ class MergeModuleTest(unittest.TestCase):
def test_add_root(self):
self.mergemodule._add_root()
- self.assertEquals(
+ self.assertEqual(
'<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" />',
etree.tostring(self.mergemodule.root))
def test_add_module(self):
self.mergemodule._add_root()
self.mergemodule._add_module()
- self.assertEquals(
+ self.assertEqual(
'<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">'
'<Module Id="_gstreamer_test" Language="1033" Version="1.0" />'
'</Wix>', etree.tostring(self.mergemodule.root))
@@ -113,7 +113,7 @@ class MergeModuleTest(unittest.TestCase):
self.mergemodule._add_root()
self.mergemodule._add_module()
self.mergemodule._add_package()
- self.assertEquals(
+ self.assertEqual(
'<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">'
'<Module Id="_gstreamer_test" Language="1033" Version="1.0">'
'<Package Comments="test" Description="GStreamer Test" Id="1" '
@@ -126,7 +126,7 @@ class MergeModuleTest(unittest.TestCase):
self.mergemodule._add_module()
self.mergemodule._add_package()
self.mergemodule._add_root_dir()
- self.assertEquals(
+ self.assertEqual(
'<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">'
'<Module Id="_gstreamer_test" Language="1033" Version="1.0">'
'<Package Comments="test" Description="GStreamer Test" Id="1" '
@@ -140,14 +140,14 @@ class MergeModuleTest(unittest.TestCase):
self.mergemodule._add_module()
self.mergemodule._add_package()
self.mergemodule._add_root_dir()
- self.assertEquals(len(self.mergemodule._dirnodes), 1)
- self.assertEquals(self.mergemodule._dirnodes[''], self.mergemodule.rdir)
+ self.assertEqual(len(self.mergemodule._dirnodes), 1)
+ self.assertEqual(self.mergemodule._dirnodes[''], self.mergemodule.rdir)
self.mergemodule._add_directory('lib/gstreamer-0.10')
- self.assertEquals(len(self.mergemodule._dirnodes), 3)
+ self.assertEqual(len(self.mergemodule._dirnodes), 3)
self.assertTrue('lib' in self.mergemodule._dirnodes)
self.assertTrue('lib/gstreamer-0.10' in self.mergemodule._dirnodes)
self.mergemodule._add_directory('bin')
- self.assertEquals(len(self.mergemodule._dirnodes), 4)
+ self.assertEqual(len(self.mergemodule._dirnodes), 4)
self.assertTrue('bin' in self.mergemodule._dirnodes)
def test_add_file(self):
@@ -155,14 +155,14 @@ class MergeModuleTest(unittest.TestCase):
self.mergemodule._add_module()
self.mergemodule._add_package()
self.mergemodule._add_root_dir()
- self.assertEquals(len(self.mergemodule._dirnodes), 1)
- self.assertEquals(self.mergemodule._dirnodes[''], self.mergemodule.rdir)
+ self.assertEqual(len(self.mergemodule._dirnodes), 1)
+ self.assertEqual(self.mergemodule._dirnodes[''], self.mergemodule.rdir)
self.mergemodule._add_file('bin/gst-inspect-0.10.exe')
- self.assertEquals(len(self.mergemodule._dirnodes), 2)
+ self.assertEqual(len(self.mergemodule._dirnodes), 2)
self.assertTrue('bin' in self.mergemodule._dirnodes)
self.assertTrue('gstreamer-0.10.exe' not in self.mergemodule._dirnodes)
self.mergemodule._add_file('bin/gst-launch-0.10.exe')
- self.assertEquals(len(self.mergemodule._dirnodes), 2)
+ self.assertEqual(len(self.mergemodule._dirnodes), 2)
self.assertTrue('bin' in self.mergemodule._dirnodes)
self.assertTrue('gstreamer-0.10.exe' not in self.mergemodule._dirnodes)
@@ -170,19 +170,19 @@ class MergeModuleTest(unittest.TestCase):
self.config.platform = Platform.WINDOWS
self.mergemodule._get_uuid = lambda : '1'
self.mergemodule.fill()
- tmp = StringIO.StringIO()
+ tmp = io.StringIO()
self.mergemodule.write(tmp)
#self._compstr(tmp.getvalue(), MERGE_MODULE)
- self.assertEquals(MERGE_MODULE, tmp.getvalue())
+ self.assertEqual(MERGE_MODULE, tmp.getvalue())
def _compstr(self, str1, str2):
str1 = str1.split('\n')
str2 = str2.split('\n')
for i in range(len(str1)):
if str1[i] != str2[i]:
- print str1[i]
- print str2[i]
- print ""
+ print(str1[i])
+ print(str2[i])
+ print("")
class InstallerTest(unittest.TestCase):
diff --git a/test/test_cerbero_tools_osxuniversalgenerator.py b/test/test_cerbero_tools_osxuniversalgenerator.py
index 4fc74637..3259238b 100644
--- a/test/test_cerbero_tools_osxuniversalgenerator.py
+++ b/test/test_cerbero_tools_osxuniversalgenerator.py
@@ -98,10 +98,10 @@ class OSXUniversalGeneratorTest(unittest.TestCase):
for arch in [Architecture.X86, Architecture.X86_64]:
res = self._get_file_type(
os.path.join(self.tmp, arch, 'lib', 'libfoo.so'))
- self.assertEquals(res, SHARED_LIBRARY[arch])
+ self.assertEqual(res, SHARED_LIBRARY[arch])
res = self._get_file_type(
os.path.join(self.tmp, arch, 'bin', 'test_app'))
- self.assertEquals(res, EXECUTABLE[arch])
+ self.assertEqual(res, EXECUTABLE[arch])
def testMergeDirs(self):
self._compile(Architecture.X86)
@@ -158,7 +158,7 @@ class OSXUniversalGeneratorTest(unittest.TestCase):
self.assertTrue(os.path.exists(file1))
self.assertTrue(os.path.exists(file2))
- self.assertEquals(os.readlink(file2), file1)
+ self.assertEqual(os.readlink(file2), file1)
def testMergePCFiles(self):
for arch in [Architecture.X86, Architecture.X86_64]:
@@ -171,7 +171,7 @@ class OSXUniversalGeneratorTest(unittest.TestCase):
[os.path.join(self.tmp, Architecture.X86),
os.path.join(self.tmp, Architecture.X86_64)])
pc_file = os.path.join(self.tmp, Architecture.UNIVERSAL, 'test.pc')
- self.assertEquals(open(pc_file).readline(),
+ self.assertEqual(open(pc_file).readline(),
os.path.join(self.tmp, Architecture.UNIVERSAL, 'lib', 'test'))
def testMergedLibraryPaths(self):
diff --git a/test/test_common.py b/test/test_common.py
index c6949656..7904b753 100644
--- a/test/test_common.py
+++ b/test/test_common.py
@@ -51,9 +51,9 @@ class XMLMixin():
n = self.find_one(parent, tag)
if attrib not in n.attrib:
self.fail("Attribute %s not found in %s" % (attrib, n))
- self.assertEquals(n.attrib[attrib], value)
+ self.assertEqual(n.attrib[attrib], value)
def check_text(self, parent, tag, value):
n = self.find_one(parent, tag)
- self.assertEquals(n.text, value)
+ self.assertEqual(n.text, value)