diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-06-30 23:06:06 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-06-30 23:06:06 (GMT) |
commit | c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9 (patch) | |
tree | 6350dab0b481e6de307dc4e043c6230f463a9ca7 /Lib/distutils/tests | |
parent | 98d23f2e065713ccfbc07d9a0b65f737a212bfb5 (diff) | |
download | cpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.zip cpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.tar.gz cpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.tar.bz2 |
convert old fail* assertions to assert*
Diffstat (limited to 'Lib/distutils/tests')
21 files changed, 106 insertions, 106 deletions
diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py index 663b335..d88e0b3 100644 --- a/Lib/distutils/tests/test_archive_util.py +++ b/Lib/distutils/tests/test_archive_util.py @@ -47,7 +47,7 @@ class ArchiveUtilTestCase(support.TempdirManager, # check if the compressed tarball was created tarball = base_name + '.tar.gz' - self.assert_(os.path.exists(tarball)) + self.assertTrue(os.path.exists(tarball)) # trying an uncompressed one base_name = os.path.join(tmpdir2, 'archive') @@ -58,7 +58,7 @@ class ArchiveUtilTestCase(support.TempdirManager, finally: os.chdir(old_dir) tarball = base_name + '.tar' - self.assert_(os.path.exists(tarball)) + self.assertTrue(os.path.exists(tarball)) def _tarinfo(self, path): tar = tarfile.open(path) @@ -96,7 +96,7 @@ class ArchiveUtilTestCase(support.TempdirManager, # check if the compressed tarball was created tarball = base_name + '.tar.gz' - self.assert_(os.path.exists(tarball)) + self.assertTrue(os.path.exists(tarball)) # now create another tarball using `tar` tarball2 = os.path.join(tmpdir, 'archive2.tar.gz') @@ -110,7 +110,7 @@ class ArchiveUtilTestCase(support.TempdirManager, finally: os.chdir(old_dir) - self.assert_(os.path.exists(tarball2)) + self.assertTrue(os.path.exists(tarball2)) # let's compare both tarballs self.assertEquals(self._tarinfo(tarball), self._tarinfo(tarball2)) @@ -123,7 +123,7 @@ class ArchiveUtilTestCase(support.TempdirManager, finally: os.chdir(old_dir) tarball = base_name + '.tar' - self.assert_(os.path.exists(tarball)) + self.assertTrue(os.path.exists(tarball)) # now for a dry_run base_name = os.path.join(tmpdir2, 'archive') @@ -134,7 +134,7 @@ class ArchiveUtilTestCase(support.TempdirManager, finally: os.chdir(old_dir) tarball = base_name + '.tar' - self.assert_(os.path.exists(tarball)) + self.assertTrue(os.path.exists(tarball)) @unittest.skipUnless(find_executable('compress'), 'The compress program is required') @@ -151,7 +151,7 @@ class ArchiveUtilTestCase(support.TempdirManager, finally: os.chdir(old_dir) tarball = base_name + '.tar.Z' - self.assert_(os.path.exists(tarball)) + self.assertTrue(os.path.exists(tarball)) self.assertEquals(len(w.warnings), 1) # same test with dry_run @@ -165,7 +165,7 @@ class ArchiveUtilTestCase(support.TempdirManager, dry_run=True) finally: os.chdir(old_dir) - self.assert_(not os.path.exists(tarball)) + self.assertTrue(not os.path.exists(tarball)) self.assertEquals(len(w.warnings), 1) @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py index 2d84007..c271567 100644 --- a/Lib/distutils/tests/test_bdist_rpm.py +++ b/Lib/distutils/tests/test_bdist_rpm.py @@ -74,7 +74,7 @@ class BuildRpmTestCase(support.TempdirManager, cmd.run() dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) - self.assert_('foo-0.1-1.noarch.rpm' in dist_created) + self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created) def test_no_optimize_flag(self): @@ -114,7 +114,7 @@ class BuildRpmTestCase(support.TempdirManager, cmd.run() dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) - self.assert_('foo-0.1-1.noarch.rpm' in dist_created) + self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created) os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm')) def test_suite(): diff --git a/Lib/distutils/tests/test_bdist_wininst.py b/Lib/distutils/tests/test_bdist_wininst.py index f2cb4fd..9b1ba6d 100644 --- a/Lib/distutils/tests/test_bdist_wininst.py +++ b/Lib/distutils/tests/test_bdist_wininst.py @@ -21,7 +21,7 @@ class BuildWinInstTestCase(support.TempdirManager, # and make sure it finds it and returns its content # no matter what platform we have exe_file = cmd.get_exe_bytes() - self.assert_(len(exe_file) > 10) + self.assertTrue(len(exe_file) > 10) def test_suite(): return unittest.makeSuite(BuildWinInstTestCase) diff --git a/Lib/distutils/tests/test_build_clib.py b/Lib/distutils/tests/test_build_clib.py index 47d85cd..536cd67 100644 --- a/Lib/distutils/tests/test_build_clib.py +++ b/Lib/distutils/tests/test_build_clib.py @@ -135,7 +135,7 @@ class BuildCLibTestCase(support.TempdirManager, cmd.run() # let's check the result - self.assert_('libfoo.a' in os.listdir(build_temp)) + self.assertTrue('libfoo.a' in os.listdir(build_temp)) def test_suite(): return unittest.makeSuite(BuildCLibTestCase) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index fe6009b..08e3e1f 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -74,15 +74,15 @@ class BuildExtTestCase(TempdirManager, import xx for attr in ('error', 'foo', 'new', 'roj'): - self.assert_(hasattr(xx, attr)) + self.assertTrue(hasattr(xx, attr)) self.assertEquals(xx.foo(2, 5), 7) self.assertEquals(xx.foo(13,15), 28) self.assertEquals(xx.new().demo(), None) doc = 'This is a template module just for instruction.' self.assertEquals(xx.__doc__, doc) - self.assert_(isinstance(xx.Null(), xx.Null)) - self.assert_(isinstance(xx.Str(), xx.Str)) + self.assertTrue(isinstance(xx.Null(), xx.Null)) + self.assertTrue(isinstance(xx.Str(), xx.Str)) def tearDown(self): # Get everything back to normal @@ -114,7 +114,7 @@ class BuildExtTestCase(TempdirManager, _config_vars['Py_ENABLE_SHARED'] = old_var # make sure we get some library dirs under solaris - self.assert_(len(cmd.library_dirs) > 0) + self.assertTrue(len(cmd.library_dirs) > 0) def test_user_site(self): # site.USER_SITE was introduced in 2.6 @@ -128,7 +128,7 @@ class BuildExtTestCase(TempdirManager, # making sure the user option is there options = [name for name, short, lable in cmd.user_options] - self.assert_('user' in options) + self.assertTrue('user' in options) # setting a value cmd.user = 1 @@ -144,9 +144,9 @@ class BuildExtTestCase(TempdirManager, # see if include_dirs and library_dirs # were set - self.assert_(lib in cmd.library_dirs) - self.assert_(lib in cmd.rpath) - self.assert_(incl in cmd.include_dirs) + self.assertTrue(lib in cmd.library_dirs) + self.assertTrue(lib in cmd.rpath) + self.assertTrue(incl in cmd.include_dirs) def test_optional_extension(self): @@ -175,10 +175,10 @@ class BuildExtTestCase(TempdirManager, from distutils import sysconfig py_include = sysconfig.get_python_inc() - self.assert_(py_include in cmd.include_dirs) + self.assertTrue(py_include in cmd.include_dirs) plat_py_include = sysconfig.get_python_inc(plat_specific=1) - self.assert_(plat_py_include in cmd.include_dirs) + self.assertTrue(plat_py_include in cmd.include_dirs) # make sure cmd.libraries is turned into a list # if it's a string @@ -192,7 +192,7 @@ class BuildExtTestCase(TempdirManager, cmd = build_ext(dist) cmd.library_dirs = 'my_lib_dir' cmd.finalize_options() - self.assert_('my_lib_dir' in cmd.library_dirs) + self.assertTrue('my_lib_dir' in cmd.library_dirs) # make sure rpath is turned into a list # if it's a list of os.pathsep's paths @@ -257,13 +257,13 @@ class BuildExtTestCase(TempdirManager, 'some': 'bar'})] cmd.check_extensions_list(exts) ext = exts[0] - self.assert_(isinstance(ext, Extension)) + self.assertTrue(isinstance(ext, Extension)) # check_extensions_list adds in ext the values passed # when they are in ('include_dirs', 'library_dirs', 'libraries' # 'extra_objects', 'extra_compile_args', 'extra_link_args') self.assertEquals(ext.libraries, 'foo') - self.assert_(not hasattr(ext, 'some')) + self.assertTrue(not hasattr(ext, 'some')) # 'macros' element of build info dict must be 1- or 2-tuple exts = [('foo.bar', {'sources': [''], 'libraries': 'foo', @@ -321,7 +321,7 @@ class BuildExtTestCase(TempdirManager, so_file = cmd.get_outputs()[0] finally: os.chdir(old_wd) - self.assert_(os.path.exists(so_file)) + self.assertTrue(os.path.exists(so_file)) self.assertEquals(os.path.splitext(so_file)[-1], sysconfig.get_config_var('SO')) so_dir = os.path.dirname(so_file) @@ -330,7 +330,7 @@ class BuildExtTestCase(TempdirManager, cmd.inplace = 0 cmd.run() so_file = cmd.get_outputs()[0] - self.assert_(os.path.exists(so_file)) + self.assertTrue(os.path.exists(so_file)) self.assertEquals(os.path.splitext(so_file)[-1], sysconfig.get_config_var('SO')) so_dir = os.path.dirname(so_file) diff --git a/Lib/distutils/tests/test_build_py.py b/Lib/distutils/tests/test_build_py.py index 75b6624..8ad3bbc 100644 --- a/Lib/distutils/tests/test_build_py.py +++ b/Lib/distutils/tests/test_build_py.py @@ -52,9 +52,9 @@ class BuildPyTestCase(support.TempdirManager, self.assertEqual(len(cmd.get_outputs()), 3) pkgdest = os.path.join(destination, "pkg") files = os.listdir(pkgdest) - self.assert_("__init__.py" in files) - self.assert_("__init__.pyc" in files) - self.assert_("README.txt" in files) + self.assertTrue("__init__.py" in files) + self.assertTrue("__init__.pyc" in files) + self.assertTrue("README.txt" in files) def test_empty_package_dir (self): # See SF 1668596/1720897. diff --git a/Lib/distutils/tests/test_build_scripts.py b/Lib/distutils/tests/test_build_scripts.py index b55eb58..b1d2d07 100644 --- a/Lib/distutils/tests/test_build_scripts.py +++ b/Lib/distutils/tests/test_build_scripts.py @@ -16,12 +16,12 @@ class BuildScriptsTestCase(support.TempdirManager, def test_default_settings(self): cmd = self.get_build_scripts_cmd("/foo/bar", []) - self.assert_(not cmd.force) - self.assert_(cmd.build_dir is None) + self.assertTrue(not cmd.force) + self.assertTrue(cmd.build_dir is None) cmd.finalize_options() - self.assert_(cmd.force) + self.assertTrue(cmd.force) self.assertEqual(cmd.build_dir, "/foo/bar") def test_build(self): @@ -37,7 +37,7 @@ class BuildScriptsTestCase(support.TempdirManager, built = os.listdir(target) for name in expected: - self.assert_(name in built) + self.assertTrue(name in built) def get_build_scripts_cmd(self, target, scripts): import sys @@ -100,7 +100,7 @@ class BuildScriptsTestCase(support.TempdirManager, built = os.listdir(target) for name in expected: - self.assert_(name in built) + self.assertTrue(name in built) def test_suite(): return unittest.makeSuite(BuildScriptsTestCase) diff --git a/Lib/distutils/tests/test_clean.py b/Lib/distutils/tests/test_clean.py index 3026032..dbc4ee2 100755 --- a/Lib/distutils/tests/test_clean.py +++ b/Lib/distutils/tests/test_clean.py @@ -35,7 +35,7 @@ class cleanTestCase(support.TempdirManager, # make sure the files where removed for name, path in dirs: - self.assert_(not os.path.exists(path), + self.assertTrue(not os.path.exists(path), '%s was not removed' % path) # let's run the command again (should spit warnings but suceed) diff --git a/Lib/distutils/tests/test_cmd.py b/Lib/distutils/tests/test_cmd.py index 8f2b36f..d6438b5 100644 --- a/Lib/distutils/tests/test_cmd.py +++ b/Lib/distutils/tests/test_cmd.py @@ -70,7 +70,7 @@ class CommandTestCase(unittest.TestCase): cmd.option2 = None cmd.ensure_string('option2', 'xxx') - self.assert_(hasattr(cmd, 'option2')) + self.assertTrue(hasattr(cmd, 'option2')) cmd.option3 = 1 self.assertRaises(DistutilsOptionError, cmd.ensure_string, 'option3') diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py index 0f97cf7..879689d 100644 --- a/Lib/distutils/tests/test_config.py +++ b/Lib/distutils/tests/test_config.py @@ -102,9 +102,9 @@ class PyPIRCCommandTestCase(support.TempdirManager, def test_server_empty_registration(self): cmd = self._cmd(self.dist) rc = cmd._get_rc_file() - self.assert_(not os.path.exists(rc)) + self.assertTrue(not os.path.exists(rc)) cmd._store_pypirc('tarek', 'xxx') - self.assert_(os.path.exists(rc)) + self.assertTrue(os.path.exists(rc)) content = open(rc).read() self.assertEquals(content, WANTED) diff --git a/Lib/distutils/tests/test_config_cmd.py b/Lib/distutils/tests/test_config_cmd.py index bacf13a..ef2e7bc 100644 --- a/Lib/distutils/tests/test_config_cmd.py +++ b/Lib/distutils/tests/test_config_cmd.py @@ -73,14 +73,14 @@ class ConfigTestCase(support.LoggingSilencer, self.write_file(f2, 'xxx') for f in (f1, f2): - self.assert_(os.path.exists(f)) + self.assertTrue(os.path.exists(f)) pkg_dir, dist = self.create_dist() cmd = config(dist) cmd._clean(f1, f2) for f in (f1, f2): - self.assert_(not os.path.exists(f)) + self.assertTrue(not os.path.exists(f)) def test_suite(): return unittest.makeSuite(ConfigTestCase) diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index 16ef68e..c031cb8 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -72,7 +72,7 @@ class DistributionTestCase(support.LoggingSilencer, self.assertEqual(d.get_command_packages(), ["distutils.command", "foo.bar", "distutils.tests"]) cmd = d.get_command_obj("test_dist") - self.assert_(isinstance(cmd, test_dist)) + self.assertTrue(isinstance(cmd, test_dist)) self.assertEqual(cmd.sample_option, "sometext") def test_command_packages_configfile(self): @@ -175,10 +175,10 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, "version": "1.0"} dist = Distribution(attrs) meta = self.format_metadata(dist) - self.assert_("Metadata-Version: 1.0" in meta) - self.assert_("provides:" not in meta.lower()) - self.assert_("requires:" not in meta.lower()) - self.assert_("obsoletes:" not in meta.lower()) + self.assertTrue("Metadata-Version: 1.0" in meta) + self.assertTrue("provides:" not in meta.lower()) + self.assertTrue("requires:" not in meta.lower()) + self.assertTrue("obsoletes:" not in meta.lower()) def test_provides(self): attrs = {"name": "package", @@ -190,9 +190,9 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, self.assertEqual(dist.get_provides(), ["package", "package.sub"]) meta = self.format_metadata(dist) - self.assert_("Metadata-Version: 1.1" in meta) - self.assert_("requires:" not in meta.lower()) - self.assert_("obsoletes:" not in meta.lower()) + self.assertTrue("Metadata-Version: 1.1" in meta) + self.assertTrue("requires:" not in meta.lower()) + self.assertTrue("obsoletes:" not in meta.lower()) def test_provides_illegal(self): self.assertRaises(ValueError, Distribution, @@ -210,11 +210,11 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, self.assertEqual(dist.get_requires(), ["other", "another (==1.0)"]) meta = self.format_metadata(dist) - self.assert_("Metadata-Version: 1.1" in meta) - self.assert_("provides:" not in meta.lower()) - self.assert_("Requires: other" in meta) - self.assert_("Requires: another (==1.0)" in meta) - self.assert_("obsoletes:" not in meta.lower()) + self.assertTrue("Metadata-Version: 1.1" in meta) + self.assertTrue("provides:" not in meta.lower()) + self.assertTrue("Requires: other" in meta) + self.assertTrue("Requires: another (==1.0)" in meta) + self.assertTrue("obsoletes:" not in meta.lower()) def test_requires_illegal(self): self.assertRaises(ValueError, Distribution, @@ -232,11 +232,11 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, self.assertEqual(dist.get_obsoletes(), ["other", "another (<1.0)"]) meta = self.format_metadata(dist) - self.assert_("Metadata-Version: 1.1" in meta) - self.assert_("provides:" not in meta.lower()) - self.assert_("requires:" not in meta.lower()) - self.assert_("Obsoletes: other" in meta) - self.assert_("Obsoletes: another (<1.0)" in meta) + self.assertTrue("Metadata-Version: 1.1" in meta) + self.assertTrue("provides:" not in meta.lower()) + self.assertTrue("requires:" not in meta.lower()) + self.assertTrue("Obsoletes: other" in meta) + self.assertTrue("Obsoletes: another (<1.0)" in meta) def test_obsoletes_illegal(self): self.assertRaises(ValueError, Distribution, @@ -270,14 +270,14 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, if sys.platform in ('linux', 'darwin'): self.environ['HOME'] = temp_dir files = dist.find_config_files() - self.assert_(user_filename in files) + self.assertTrue(user_filename in files) # win32-style if sys.platform == 'win32': # home drive should be found self.environ['HOME'] = temp_dir files = dist.find_config_files() - self.assert_(user_filename in files, + self.assertTrue(user_filename in files, '%r not found in %r' % (user_filename, files)) finally: os.remove(user_filename) @@ -303,7 +303,7 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, output = [line for line in s.getvalue().split('\n') if line.strip() != ''] - self.assert_(len(output) > 0) + self.assertTrue(len(output) > 0) def test_suite(): suite = unittest.TestSuite() diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py index 8d7e972..d0ad5ce 100644 --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -88,7 +88,7 @@ class InstallTestCase(support.TempdirManager, def _test_user_site(self): for key in ('nt_user', 'unix_user', 'os2_home'): - self.assert_(key in INSTALL_SCHEMES) + self.assertTrue(key in INSTALL_SCHEMES) dist = Distribution({'name': 'xx'}) cmd = install(dist) @@ -96,24 +96,24 @@ class InstallTestCase(support.TempdirManager, # making sure the user option is there options = [name for name, short, lable in cmd.user_options] - self.assert_('user' in options) + self.assertTrue('user' in options) # setting a value cmd.user = 1 # user base and site shouldn't be created yet - self.assert_(not os.path.exists(self.user_base)) - self.assert_(not os.path.exists(self.user_site)) + self.assertTrue(not os.path.exists(self.user_base)) + self.assertTrue(not os.path.exists(self.user_site)) # let's run finalize cmd.ensure_finalized() # now they should - self.assert_(os.path.exists(self.user_base)) - self.assert_(os.path.exists(self.user_site)) + self.assertTrue(os.path.exists(self.user_base)) + self.assertTrue(os.path.exists(self.user_site)) - self.assert_('userbase' in cmd.config_vars) - self.assert_('usersite' in cmd.config_vars) + self.assertTrue('userbase' in cmd.config_vars) + self.assertTrue('usersite' in cmd.config_vars) def test_handle_extra_path(self): dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'}) diff --git a/Lib/distutils/tests/test_install_data.py b/Lib/distutils/tests/test_install_data.py index 73c4037..7072136 100644 --- a/Lib/distutils/tests/test_install_data.py +++ b/Lib/distutils/tests/test_install_data.py @@ -35,9 +35,9 @@ class InstallDataTestCase(support.TempdirManager, # let's check the result self.assertEquals(len(cmd.get_outputs()), 2) rtwo = os.path.split(two)[-1] - self.assert_(os.path.exists(os.path.join(inst2, rtwo))) + self.assertTrue(os.path.exists(os.path.join(inst2, rtwo))) rone = os.path.split(one)[-1] - self.assert_(os.path.exists(os.path.join(inst, rone))) + self.assertTrue(os.path.exists(os.path.join(inst, rone))) cmd.outfiles = [] # let's try with warn_dir one @@ -47,8 +47,8 @@ class InstallDataTestCase(support.TempdirManager, # let's check the result self.assertEquals(len(cmd.get_outputs()), 2) - self.assert_(os.path.exists(os.path.join(inst2, rtwo))) - self.assert_(os.path.exists(os.path.join(inst, rone))) + self.assertTrue(os.path.exists(os.path.join(inst2, rtwo))) + self.assertTrue(os.path.exists(os.path.join(inst, rone))) cmd.outfiles = [] # now using root and empty dir @@ -65,8 +65,8 @@ class InstallDataTestCase(support.TempdirManager, # let's check the result self.assertEquals(len(cmd.get_outputs()), 4) - self.assert_(os.path.exists(os.path.join(inst2, rtwo))) - self.assert_(os.path.exists(os.path.join(inst, rone))) + self.assertTrue(os.path.exists(os.path.join(inst2, rtwo))) + self.assertTrue(os.path.exists(os.path.join(inst, rone))) def test_suite(): return unittest.makeSuite(InstallDataTestCase) diff --git a/Lib/distutils/tests/test_install_lib.py b/Lib/distutils/tests/test_install_lib.py index d768166..793b95c 100644 --- a/Lib/distutils/tests/test_install_lib.py +++ b/Lib/distutils/tests/test_install_lib.py @@ -39,8 +39,8 @@ class InstallLibTestCase(support.TempdirManager, f = os.path.join(pkg_dir, 'foo.py') self.write_file(f, '# python file') cmd.byte_compile([f]) - self.assert_(os.path.exists(os.path.join(pkg_dir, 'foo.pyc'))) - self.assert_(os.path.exists(os.path.join(pkg_dir, 'foo.pyo'))) + self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'foo.pyc'))) + self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'foo.pyo'))) def test_get_outputs(self): pkg_dir, dist = self.create_dist() @@ -57,7 +57,7 @@ class InstallLibTestCase(support.TempdirManager, cmd.distribution.script_name = 'setup.py' # get_output should return 4 elements - self.assert_(len(cmd.get_outputs()) >= 2) + self.assertTrue(len(cmd.get_outputs()) >= 2) def test_get_inputs(self): pkg_dir, dist = self.create_dist() diff --git a/Lib/distutils/tests/test_install_scripts.py b/Lib/distutils/tests/test_install_scripts.py index fffa6ef..b7eb625 100644 --- a/Lib/distutils/tests/test_install_scripts.py +++ b/Lib/distutils/tests/test_install_scripts.py @@ -23,15 +23,15 @@ class InstallScriptsTestCase(support.TempdirManager, skip_build=1, ) cmd = install_scripts(dist) - self.assert_(not cmd.force) - self.assert_(not cmd.skip_build) - self.assert_(cmd.build_dir is None) - self.assert_(cmd.install_dir is None) + self.assertTrue(not cmd.force) + self.assertTrue(not cmd.skip_build) + self.assertTrue(cmd.build_dir is None) + self.assertTrue(cmd.install_dir is None) cmd.finalize_options() - self.assert_(cmd.force) - self.assert_(cmd.skip_build) + self.assertTrue(cmd.force) + self.assertTrue(cmd.skip_build) self.assertEqual(cmd.build_dir, "/foo/bar") self.assertEqual(cmd.install_dir, "/splat/funk") @@ -69,7 +69,7 @@ class InstallScriptsTestCase(support.TempdirManager, installed = os.listdir(target) for name in expected: - self.assert_(name in installed) + self.assertTrue(name in installed) def test_suite(): diff --git a/Lib/distutils/tests/test_msvc9compiler.py b/Lib/distutils/tests/test_msvc9compiler.py index 11e5a47..7382798 100644 --- a/Lib/distutils/tests/test_msvc9compiler.py +++ b/Lib/distutils/tests/test_msvc9compiler.py @@ -46,7 +46,7 @@ class msvc9compilerTestCase(unittest.TestCase): # windows registeries versions. path = r'Software\Microsoft\Notepad' v = Reg.get_value(path, "lfitalic") - self.assert_(v in (0, 1)) + self.assertTrue(v in (0, 1)) import winreg HKCU = winreg.HKEY_CURRENT_USER @@ -54,7 +54,7 @@ class msvc9compilerTestCase(unittest.TestCase): self.assertEquals(keys, None) keys = Reg.read_keys(HKCU, r'Software\Microsoft') - self.assert_('Notepad' in keys) + self.assertTrue('Notepad' in keys) def test_suite(): return unittest.makeSuite(msvc9compilerTestCase) diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py index d9ff3ec..c03ad10 100644 --- a/Lib/distutils/tests/test_register.py +++ b/Lib/distutils/tests/test_register.py @@ -96,7 +96,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): cmd = self._get_cmd() # we shouldn't have a .pypirc file yet - self.assert_(not os.path.exists(self.rc)) + self.assertTrue(not os.path.exists(self.rc)) # patching input and getpass.getpass # so register gets happy @@ -115,7 +115,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): del register_module.input # we should have a brand new .pypirc file - self.assert_(os.path.exists(self.rc)) + self.assertTrue(os.path.exists(self.rc)) # with the content similar to WANTED_PYPIRC content = open(self.rc).read() @@ -133,13 +133,13 @@ class RegisterTestCase(PyPIRCCommandTestCase): # let's see what the server received : we should # have 2 similar requests - self.assert_(self.conn.reqs, 2) + self.assertTrue(self.conn.reqs, 2) req1 = dict(self.conn.reqs[0].headers) req2 = dict(self.conn.reqs[1].headers) self.assertEquals(req1['Content-length'], '1374') self.assertEquals(req2['Content-length'], '1374') - self.assert_((b'xxx') in self.conn.reqs[1].data) + self.assertTrue((b'xxx') in self.conn.reqs[1].data) def test_password_not_in_file(self): @@ -165,11 +165,11 @@ class RegisterTestCase(PyPIRCCommandTestCase): del register_module.input # we should have send a request - self.assert_(self.conn.reqs, 1) + self.assertTrue(self.conn.reqs, 1) req = self.conn.reqs[0] headers = dict(req.headers) self.assertEquals(headers['Content-length'], '608') - self.assert_((b'tarek') in req.data) + self.assertTrue((b'tarek') in req.data) def test_password_reset(self): # this test runs choice 3 @@ -183,11 +183,11 @@ class RegisterTestCase(PyPIRCCommandTestCase): del register_module.input # we should have send a request - self.assert_(self.conn.reqs, 1) + self.assertTrue(self.conn.reqs, 1) req = self.conn.reqs[0] headers = dict(req.headers) self.assertEquals(headers['Content-length'], '290') - self.assert_((b'tarek') in req.data) + self.assertTrue((b'tarek') in req.data) def test_strict(self): # testing the script option diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py index 2d8fa27..eb36204 100644 --- a/Lib/distutils/tests/test_sysconfig.py +++ b/Lib/distutils/tests/test_sysconfig.py @@ -21,12 +21,12 @@ class SysconfigTestCase(support.EnvironGuard, def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() - self.assert_(os.path.isfile(config_h), config_h) + self.assertTrue(os.path.isfile(config_h), config_h) def test_get_python_lib(self): lib_dir = sysconfig.get_python_lib() # XXX doesn't work on Linux when Python was never installed before - #self.assert_(os.path.isdir(lib_dir), lib_dir) + #self.assertTrue(os.path.isdir(lib_dir), lib_dir) # test for pythonxx.lib? self.assertNotEqual(sysconfig.get_python_lib(), sysconfig.get_python_lib(prefix=TESTFN)) @@ -36,14 +36,14 @@ class SysconfigTestCase(support.EnvironGuard, # This is not much of a test. We make sure Python.h exists # in the directory returned by get_python_inc() but we don't know # it is the correct file. - self.assert_(os.path.isdir(inc_dir), inc_dir) + self.assertTrue(os.path.isdir(inc_dir), inc_dir) python_h = os.path.join(inc_dir, "Python.h") - self.assert_(os.path.isfile(python_h), python_h) + self.assertTrue(os.path.isfile(python_h), python_h) def test_get_config_vars(self): cvars = sysconfig.get_config_vars() - self.assert_(isinstance(cvars, dict)) - self.assert_(cvars) + self.assertTrue(isinstance(cvars, dict)) + self.assertTrue(cvars) def test_customize_compiler(self): diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py index aaeaffd..9281885 100644 --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -96,11 +96,11 @@ class uploadTestCase(PyPIRCCommandTestCase): # what did we send ? headers = dict(self.last_open.req.headers) self.assertEquals(headers['Content-length'], '2087') - self.assert_(headers['Content-type'].startswith('multipart/form-data')) + self.assertTrue(headers['Content-type'].startswith('multipart/form-data')) self.assertEquals(self.last_open.req.get_method(), 'POST') self.assertEquals(self.last_open.req.get_full_url(), 'http://pypi.python.org/pypi') - self.assert_(b'xxx' in self.last_open.req.data) + self.assertTrue(b'xxx' in self.last_open.req.data) def test_suite(): return unittest.makeSuite(uploadTestCase) diff --git a/Lib/distutils/tests/test_util.py b/Lib/distutils/tests/test_util.py index cee7d52..c0acf5f 100644 --- a/Lib/distutils/tests/test_util.py +++ b/Lib/distutils/tests/test_util.py @@ -225,10 +225,10 @@ class UtilTestCase(support.EnvironGuard, unittest.TestCase): no = ('n', 'no', 'f', 'false', 'off', '0', 'Off', 'No', 'N') for y in yes: - self.assert_(strtobool(y)) + self.assertTrue(strtobool(y)) for n in no: - self.assert_(not strtobool(n)) + self.assertTrue(not strtobool(n)) def test_rfc822_escape(self): header = 'I am a\npoor\nlonesome\nheader\n' |