Commit d82693d9 authored by Ezio Melotti's avatar Ezio Melotti

Merged revisions 86596 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line

  #9424: Replace deprecated assert* methods in the Python test suite.
........
parent d9cf33af
...@@ -129,7 +129,7 @@ class ArchiveUtilTestCase(support.TempdirManager, ...@@ -129,7 +129,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
self.assertTrue(os.path.exists(tarball2)) self.assertTrue(os.path.exists(tarball2))
# let's compare both tarballs # let's compare both tarballs
self.assertEquals(self._tarinfo(tarball), self._tarinfo(tarball2)) self.assertEqual(self._tarinfo(tarball), self._tarinfo(tarball2))
# trying an uncompressed one # trying an uncompressed one
base_name = os.path.join(tmpdir2, 'archive') base_name = os.path.join(tmpdir2, 'archive')
...@@ -169,7 +169,7 @@ class ArchiveUtilTestCase(support.TempdirManager, ...@@ -169,7 +169,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
os.chdir(old_dir) os.chdir(old_dir)
tarball = base_name + '.tar.Z' tarball = base_name + '.tar.Z'
self.assertTrue(os.path.exists(tarball)) self.assertTrue(os.path.exists(tarball))
self.assertEquals(len(w.warnings), 1) self.assertEqual(len(w.warnings), 1)
# same test with dry_run # same test with dry_run
os.remove(tarball) os.remove(tarball)
...@@ -183,7 +183,7 @@ class ArchiveUtilTestCase(support.TempdirManager, ...@@ -183,7 +183,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
finally: finally:
os.chdir(old_dir) os.chdir(old_dir)
self.assertTrue(not os.path.exists(tarball)) self.assertTrue(not os.path.exists(tarball))
self.assertEquals(len(w.warnings), 1) self.assertEqual(len(w.warnings), 1)
@unittest.skipUnless(zlib, "Requires zlib") @unittest.skipUnless(zlib, "Requires zlib")
@unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run')
...@@ -201,9 +201,9 @@ class ArchiveUtilTestCase(support.TempdirManager, ...@@ -201,9 +201,9 @@ class ArchiveUtilTestCase(support.TempdirManager,
tarball = base_name + '.zip' tarball = base_name + '.zip'
def test_check_archive_formats(self): def test_check_archive_formats(self):
self.assertEquals(check_archive_formats(['gztar', 'xxx', 'zip']), self.assertEqual(check_archive_formats(['gztar', 'xxx', 'zip']),
'xxx') 'xxx')
self.assertEquals(check_archive_formats(['gztar', 'zip']), None) self.assertEqual(check_archive_formats(['gztar', 'zip']), None)
def test_make_archive(self): def test_make_archive(self):
tmpdir = self.mkdtemp() tmpdir = self.mkdtemp()
...@@ -258,8 +258,8 @@ class ArchiveUtilTestCase(support.TempdirManager, ...@@ -258,8 +258,8 @@ class ArchiveUtilTestCase(support.TempdirManager,
archive = tarfile.open(archive_name) archive = tarfile.open(archive_name)
try: try:
for member in archive.getmembers(): for member in archive.getmembers():
self.assertEquals(member.uid, 0) self.assertEqual(member.uid, 0)
self.assertEquals(member.gid, 0) self.assertEqual(member.gid, 0)
finally: finally:
archive.close() archive.close()
...@@ -273,7 +273,7 @@ class ArchiveUtilTestCase(support.TempdirManager, ...@@ -273,7 +273,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
make_archive('xxx', 'xxx', root_dir=self.mkdtemp()) make_archive('xxx', 'xxx', root_dir=self.mkdtemp())
except: except:
pass pass
self.assertEquals(os.getcwd(), current_dir) self.assertEqual(os.getcwd(), current_dir)
finally: finally:
del ARCHIVE_FORMATS['xxx'] del ARCHIVE_FORMATS['xxx']
......
...@@ -25,7 +25,7 @@ class BuildTestCase(support.TempdirManager, ...@@ -25,7 +25,7 @@ class BuildTestCase(support.TempdirManager,
cmd = bdist(dist) cmd = bdist(dist)
cmd.formats = ['msi'] cmd.formats = ['msi']
cmd.ensure_finalized() cmd.ensure_finalized()
self.assertEquals(cmd.formats, ['msi']) self.assertEqual(cmd.formats, ['msi'])
# what format bdist offers ? # what format bdist offers ?
# XXX an explicit list in bdist is # XXX an explicit list in bdist is
...@@ -36,7 +36,7 @@ class BuildTestCase(support.TempdirManager, ...@@ -36,7 +36,7 @@ class BuildTestCase(support.TempdirManager,
formats.sort() formats.sort()
founded = cmd.format_command.keys() founded = cmd.format_command.keys()
founded.sort() founded.sort()
self.assertEquals(founded, formats) self.assertEqual(founded, formats)
def test_suite(): def test_suite():
return unittest.makeSuite(BuildTestCase) return unittest.makeSuite(BuildTestCase)
......
...@@ -78,7 +78,7 @@ class BuildDumbTestCase(support.TempdirManager, ...@@ -78,7 +78,7 @@ class BuildDumbTestCase(support.TempdirManager,
base = base.replace(':', '-') base = base.replace(':', '-')
wanted = ['%s.zip' % base] wanted = ['%s.zip' % base]
self.assertEquals(dist_created, wanted) self.assertEqual(dist_created, wanted)
# now let's check what we have in the zip file # now let's check what we have in the zip file
# XXX to be done # XXX to be done
...@@ -87,16 +87,16 @@ class BuildDumbTestCase(support.TempdirManager, ...@@ -87,16 +87,16 @@ class BuildDumbTestCase(support.TempdirManager,
pkg_dir, dist = self.create_dist() pkg_dir, dist = self.create_dist()
os.chdir(pkg_dir) os.chdir(pkg_dir)
cmd = bdist_dumb(dist) cmd = bdist_dumb(dist)
self.assertEquals(cmd.bdist_dir, None) self.assertEqual(cmd.bdist_dir, None)
cmd.finalize_options() cmd.finalize_options()
# bdist_dir is initialized to bdist_base/dumb if not set # bdist_dir is initialized to bdist_base/dumb if not set
base = cmd.get_finalized_command('bdist').bdist_base base = cmd.get_finalized_command('bdist').bdist_base
self.assertEquals(cmd.bdist_dir, os.path.join(base, 'dumb')) self.assertEqual(cmd.bdist_dir, os.path.join(base, 'dumb'))
# the format is set to a default value depending on the os.name # the format is set to a default value depending on the os.name
default = cmd.default_format[os.name] default = cmd.default_format[os.name]
self.assertEquals(cmd.format, default) self.assertEqual(cmd.format, default)
def test_suite(): def test_suite():
return unittest.makeSuite(BuildDumbTestCase) return unittest.makeSuite(BuildDumbTestCase)
......
...@@ -17,11 +17,11 @@ class BuildTestCase(support.TempdirManager, ...@@ -17,11 +17,11 @@ class BuildTestCase(support.TempdirManager,
cmd.finalize_options() cmd.finalize_options()
# if not specified, plat_name gets the current platform # if not specified, plat_name gets the current platform
self.assertEquals(cmd.plat_name, get_platform()) self.assertEqual(cmd.plat_name, get_platform())
# build_purelib is build + lib # build_purelib is build + lib
wanted = os.path.join(cmd.build_base, 'lib') wanted = os.path.join(cmd.build_base, 'lib')
self.assertEquals(cmd.build_purelib, wanted) self.assertEqual(cmd.build_purelib, wanted)
# build_platlib is 'build/lib.platform-x.x[-pydebug]' # build_platlib is 'build/lib.platform-x.x[-pydebug]'
# examples: # examples:
...@@ -31,21 +31,21 @@ class BuildTestCase(support.TempdirManager, ...@@ -31,21 +31,21 @@ class BuildTestCase(support.TempdirManager,
self.assertTrue(cmd.build_platlib.endswith('-pydebug')) self.assertTrue(cmd.build_platlib.endswith('-pydebug'))
plat_spec += '-pydebug' plat_spec += '-pydebug'
wanted = os.path.join(cmd.build_base, 'lib' + plat_spec) wanted = os.path.join(cmd.build_base, 'lib' + plat_spec)
self.assertEquals(cmd.build_platlib, wanted) self.assertEqual(cmd.build_platlib, wanted)
# by default, build_lib = build_purelib # by default, build_lib = build_purelib
self.assertEquals(cmd.build_lib, cmd.build_purelib) self.assertEqual(cmd.build_lib, cmd.build_purelib)
# build_temp is build/temp.<plat> # build_temp is build/temp.<plat>
wanted = os.path.join(cmd.build_base, 'temp' + plat_spec) wanted = os.path.join(cmd.build_base, 'temp' + plat_spec)
self.assertEquals(cmd.build_temp, wanted) self.assertEqual(cmd.build_temp, wanted)
# build_scripts is build/scripts-x.x # build_scripts is build/scripts-x.x
wanted = os.path.join(cmd.build_base, 'scripts-' + sys.version[0:3]) wanted = os.path.join(cmd.build_base, 'scripts-' + sys.version[0:3])
self.assertEquals(cmd.build_scripts, wanted) self.assertEqual(cmd.build_scripts, wanted)
# executable is os.path.normpath(sys.executable) # executable is os.path.normpath(sys.executable)
self.assertEquals(cmd.executable, os.path.normpath(sys.executable)) self.assertEqual(cmd.executable, os.path.normpath(sys.executable))
def test_suite(): def test_suite():
return unittest.makeSuite(BuildTestCase) return unittest.makeSuite(BuildTestCase)
......
...@@ -55,14 +55,14 @@ class BuildCLibTestCase(support.TempdirManager, ...@@ -55,14 +55,14 @@ class BuildCLibTestCase(support.TempdirManager,
self.assertRaises(DistutilsSetupError, cmd.get_source_files) self.assertRaises(DistutilsSetupError, cmd.get_source_files)
cmd.libraries = [('name', {'sources': ['a', 'b']})] cmd.libraries = [('name', {'sources': ['a', 'b']})]
self.assertEquals(cmd.get_source_files(), ['a', 'b']) self.assertEqual(cmd.get_source_files(), ['a', 'b'])
cmd.libraries = [('name', {'sources': ('a', 'b')})] cmd.libraries = [('name', {'sources': ('a', 'b')})]
self.assertEquals(cmd.get_source_files(), ['a', 'b']) self.assertEqual(cmd.get_source_files(), ['a', 'b'])
cmd.libraries = [('name', {'sources': ('a', 'b')}), cmd.libraries = [('name', {'sources': ('a', 'b')}),
('name2', {'sources': ['c', 'd']})] ('name2', {'sources': ['c', 'd']})]
self.assertEquals(cmd.get_source_files(), ['a', 'b', 'c', 'd']) self.assertEqual(cmd.get_source_files(), ['a', 'b', 'c', 'd'])
def test_build_libraries(self): def test_build_libraries(self):
...@@ -91,11 +91,11 @@ class BuildCLibTestCase(support.TempdirManager, ...@@ -91,11 +91,11 @@ class BuildCLibTestCase(support.TempdirManager,
cmd.include_dirs = 'one-dir' cmd.include_dirs = 'one-dir'
cmd.finalize_options() cmd.finalize_options()
self.assertEquals(cmd.include_dirs, ['one-dir']) self.assertEqual(cmd.include_dirs, ['one-dir'])
cmd.include_dirs = None cmd.include_dirs = None
cmd.finalize_options() cmd.finalize_options()
self.assertEquals(cmd.include_dirs, []) self.assertEqual(cmd.include_dirs, [])
cmd.distribution.libraries = 'WONTWORK' cmd.distribution.libraries = 'WONTWORK'
self.assertRaises(DistutilsSetupError, cmd.finalize_options) self.assertRaises(DistutilsSetupError, cmd.finalize_options)
......
This diff is collapsed.
...@@ -32,7 +32,7 @@ class CCompilerTestCase(support.EnvironGuard, unittest.TestCase): ...@@ -32,7 +32,7 @@ class CCompilerTestCase(support.EnvironGuard, unittest.TestCase):
opts = gen_lib_options(compiler, libdirs, runlibdirs, libs) opts = gen_lib_options(compiler, libdirs, runlibdirs, libs)
wanted = ['-Llib1', '-Llib2', '-cool', '-Rrunlib1', 'found', wanted = ['-Llib1', '-Llib2', '-cool', '-Rrunlib1', 'found',
'-lname2'] '-lname2']
self.assertEquals(opts, wanted) self.assertEqual(opts, wanted)
def test_debug_print(self): def test_debug_print(self):
...@@ -43,14 +43,14 @@ class CCompilerTestCase(support.EnvironGuard, unittest.TestCase): ...@@ -43,14 +43,14 @@ class CCompilerTestCase(support.EnvironGuard, unittest.TestCase):
with captured_stdout() as stdout: with captured_stdout() as stdout:
compiler.debug_print('xxx') compiler.debug_print('xxx')
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), '') self.assertEqual(stdout.read(), '')
debug.DEBUG = True debug.DEBUG = True
try: try:
with captured_stdout() as stdout: with captured_stdout() as stdout:
compiler.debug_print('xxx') compiler.debug_print('xxx')
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), 'xxx\n') self.assertEqual(stdout.read(), 'xxx\n')
finally: finally:
debug.DEBUG = False debug.DEBUG = False
...@@ -72,7 +72,7 @@ class CCompilerTestCase(support.EnvironGuard, unittest.TestCase): ...@@ -72,7 +72,7 @@ class CCompilerTestCase(support.EnvironGuard, unittest.TestCase):
comp = compiler() comp = compiler()
customize_compiler(comp) customize_compiler(comp)
self.assertEquals(comp.exes['archiver'], 'my_ar -arflags') self.assertEqual(comp.exes['archiver'], 'my_ar -arflags')
def test_suite(): def test_suite():
return unittest.makeSuite(CCompilerTestCase) return unittest.makeSuite(CCompilerTestCase)
......
...@@ -26,7 +26,7 @@ class CheckTestCase(support.LoggingSilencer, ...@@ -26,7 +26,7 @@ class CheckTestCase(support.LoggingSilencer,
# by default, check is checking the metadata # by default, check is checking the metadata
# should have some warnings # should have some warnings
cmd = self._run() cmd = self._run()
self.assertEquals(cmd._warnings, 2) self.assertEqual(cmd._warnings, 2)
# now let's add the required fields # now let's add the required fields
# and run it again, to make sure we don't get # and run it again, to make sure we don't get
...@@ -35,7 +35,7 @@ class CheckTestCase(support.LoggingSilencer, ...@@ -35,7 +35,7 @@ class CheckTestCase(support.LoggingSilencer,
'author_email': 'xxx', 'author_email': 'xxx',
'name': 'xxx', 'version': 'xxx'} 'name': 'xxx', 'version': 'xxx'}
cmd = self._run(metadata) cmd = self._run(metadata)
self.assertEquals(cmd._warnings, 0) self.assertEqual(cmd._warnings, 0)
# now with the strict mode, we should # now with the strict mode, we should
# get an error if there are missing metadata # get an error if there are missing metadata
...@@ -43,7 +43,7 @@ class CheckTestCase(support.LoggingSilencer, ...@@ -43,7 +43,7 @@ class CheckTestCase(support.LoggingSilencer,
# and of course, no error when all metadata are present # and of course, no error when all metadata are present
cmd = self._run(metadata, strict=1) cmd = self._run(metadata, strict=1)
self.assertEquals(cmd._warnings, 0) self.assertEqual(cmd._warnings, 0)
def test_check_document(self): def test_check_document(self):
if not HAS_DOCUTILS: # won't test without docutils if not HAS_DOCUTILS: # won't test without docutils
...@@ -54,12 +54,12 @@ class CheckTestCase(support.LoggingSilencer, ...@@ -54,12 +54,12 @@ class CheckTestCase(support.LoggingSilencer,
# let's see if it detects broken rest # let's see if it detects broken rest
broken_rest = 'title\n===\n\ntest' broken_rest = 'title\n===\n\ntest'
msgs = cmd._check_rst_data(broken_rest) msgs = cmd._check_rst_data(broken_rest)
self.assertEquals(len(msgs), 1) self.assertEqual(len(msgs), 1)
# and non-broken rest # and non-broken rest
rest = 'title\n=====\n\ntest' rest = 'title\n=====\n\ntest'
msgs = cmd._check_rst_data(rest) msgs = cmd._check_rst_data(rest)
self.assertEquals(len(msgs), 0) self.assertEqual(len(msgs), 0)
def test_check_restructuredtext(self): def test_check_restructuredtext(self):
if not HAS_DOCUTILS: # won't test without docutils if not HAS_DOCUTILS: # won't test without docutils
...@@ -69,7 +69,7 @@ class CheckTestCase(support.LoggingSilencer, ...@@ -69,7 +69,7 @@ class CheckTestCase(support.LoggingSilencer,
pkg_info, dist = self.create_dist(long_description=broken_rest) pkg_info, dist = self.create_dist(long_description=broken_rest)
cmd = check(dist) cmd = check(dist)
cmd.check_restructuredtext() cmd.check_restructuredtext()
self.assertEquals(cmd._warnings, 1) self.assertEqual(cmd._warnings, 1)
# let's see if we have an error with strict=1 # let's see if we have an error with strict=1
metadata = {'url': 'xxx', 'author': 'xxx', metadata = {'url': 'xxx', 'author': 'xxx',
...@@ -82,7 +82,7 @@ class CheckTestCase(support.LoggingSilencer, ...@@ -82,7 +82,7 @@ class CheckTestCase(support.LoggingSilencer,
# and non-broken rest # and non-broken rest
metadata['long_description'] = 'title\n=====\n\ntest' metadata['long_description'] = 'title\n=====\n\ntest'
cmd = self._run(metadata, strict=1, restructuredtext=1) cmd = self._run(metadata, strict=1, restructuredtext=1)
self.assertEquals(cmd._warnings, 0) self.assertEqual(cmd._warnings, 0)
def test_check_all(self): def test_check_all(self):
......
...@@ -44,7 +44,7 @@ class CommandTestCase(unittest.TestCase): ...@@ -44,7 +44,7 @@ class CommandTestCase(unittest.TestCase):
# making sure execute gets called properly # making sure execute gets called properly
def _execute(func, args, exec_msg, level): def _execute(func, args, exec_msg, level):
self.assertEquals(exec_msg, 'generating out from in') self.assertEqual(exec_msg, 'generating out from in')
cmd.force = True cmd.force = True
cmd.execute = _execute cmd.execute = _execute
cmd.make_file(infiles='in', outfile='out', func='func', args=()) cmd.make_file(infiles='in', outfile='out', func='func', args=())
...@@ -63,7 +63,7 @@ class CommandTestCase(unittest.TestCase): ...@@ -63,7 +63,7 @@ class CommandTestCase(unittest.TestCase):
wanted = ["command options for 'MyCmd':", ' option1 = 1', wanted = ["command options for 'MyCmd':", ' option1 = 1',
' option2 = 1'] ' option2 = 1']
self.assertEquals(msgs, wanted) self.assertEqual(msgs, wanted)
def test_ensure_string(self): def test_ensure_string(self):
cmd = self.cmd cmd = self.cmd
...@@ -81,7 +81,7 @@ class CommandTestCase(unittest.TestCase): ...@@ -81,7 +81,7 @@ class CommandTestCase(unittest.TestCase):
cmd = self.cmd cmd = self.cmd
cmd.option1 = 'ok,dok' cmd.option1 = 'ok,dok'
cmd.ensure_string_list('option1') cmd.ensure_string_list('option1')
self.assertEquals(cmd.option1, ['ok', 'dok']) self.assertEqual(cmd.option1, ['ok', 'dok'])
cmd.option2 = ['xxx', 'www'] cmd.option2 = ['xxx', 'www']
cmd.ensure_string_list('option2') cmd.ensure_string_list('option2')
...@@ -109,14 +109,14 @@ class CommandTestCase(unittest.TestCase): ...@@ -109,14 +109,14 @@ class CommandTestCase(unittest.TestCase):
with captured_stdout() as stdout: with captured_stdout() as stdout:
cmd.debug_print('xxx') cmd.debug_print('xxx')
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), '') self.assertEqual(stdout.read(), '')
debug.DEBUG = True debug.DEBUG = True
try: try:
with captured_stdout() as stdout: with captured_stdout() as stdout:
cmd.debug_print('xxx') cmd.debug_print('xxx')
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), 'xxx\n') self.assertEqual(stdout.read(), 'xxx\n')
finally: finally:
debug.DEBUG = False debug.DEBUG = False
......
...@@ -90,7 +90,7 @@ class PyPIRCCommandTestCase(support.TempdirManager, ...@@ -90,7 +90,7 @@ class PyPIRCCommandTestCase(support.TempdirManager,
waited = [('password', 'secret'), ('realm', 'pypi'), waited = [('password', 'secret'), ('realm', 'pypi'),
('repository', 'http://pypi.python.org/pypi'), ('repository', 'http://pypi.python.org/pypi'),
('server', 'server1'), ('username', 'me')] ('server', 'server1'), ('username', 'me')]
self.assertEquals(config, waited) self.assertEqual(config, waited)
# old format # old format
self.write_file(self.rc, PYPIRC_OLD) self.write_file(self.rc, PYPIRC_OLD)
...@@ -100,7 +100,7 @@ class PyPIRCCommandTestCase(support.TempdirManager, ...@@ -100,7 +100,7 @@ class PyPIRCCommandTestCase(support.TempdirManager,
waited = [('password', 'secret'), ('realm', 'pypi'), waited = [('password', 'secret'), ('realm', 'pypi'),
('repository', 'http://pypi.python.org/pypi'), ('repository', 'http://pypi.python.org/pypi'),
('server', 'server-login'), ('username', 'tarek')] ('server', 'server-login'), ('username', 'tarek')]
self.assertEquals(config, waited) self.assertEqual(config, waited)
def test_server_empty_registration(self): def test_server_empty_registration(self):
cmd = self._cmd(self.dist) cmd = self._cmd(self.dist)
...@@ -111,7 +111,7 @@ class PyPIRCCommandTestCase(support.TempdirManager, ...@@ -111,7 +111,7 @@ class PyPIRCCommandTestCase(support.TempdirManager,
f = open(rc) f = open(rc)
try: try:
content = f.read() content = f.read()
self.assertEquals(content, WANTED) self.assertEqual(content, WANTED)
finally: finally:
f.close() f.close()
......
...@@ -34,7 +34,7 @@ class ConfigTestCase(support.LoggingSilencer, ...@@ -34,7 +34,7 @@ class ConfigTestCase(support.LoggingSilencer,
f.close() f.close()
dump_file(this_file, 'I am the header') dump_file(this_file, 'I am the header')
self.assertEquals(len(self._logs), numlines+1) self.assertEqual(len(self._logs), numlines+1)
def test_search_cpp(self): def test_search_cpp(self):
if sys.platform == 'win32': if sys.platform == 'win32':
...@@ -44,10 +44,10 @@ class ConfigTestCase(support.LoggingSilencer, ...@@ -44,10 +44,10 @@ class ConfigTestCase(support.LoggingSilencer,
# simple pattern searches # simple pattern searches
match = cmd.search_cpp(pattern='xxx', body='// xxx') match = cmd.search_cpp(pattern='xxx', body='// xxx')
self.assertEquals(match, 0) self.assertEqual(match, 0)
match = cmd.search_cpp(pattern='_configtest', body='// xxx') match = cmd.search_cpp(pattern='_configtest', body='// xxx')
self.assertEquals(match, 1) self.assertEqual(match, 1)
def test_finalize_options(self): def test_finalize_options(self):
# finalize_options does a bit of transformation # finalize_options does a bit of transformation
...@@ -59,9 +59,9 @@ class ConfigTestCase(support.LoggingSilencer, ...@@ -59,9 +59,9 @@ class ConfigTestCase(support.LoggingSilencer,
cmd.library_dirs = 'three%sfour' % os.pathsep cmd.library_dirs = 'three%sfour' % os.pathsep
cmd.ensure_finalized() cmd.ensure_finalized()
self.assertEquals(cmd.include_dirs, ['one', 'two']) self.assertEqual(cmd.include_dirs, ['one', 'two'])
self.assertEquals(cmd.libraries, ['one']) self.assertEqual(cmd.libraries, ['one'])
self.assertEquals(cmd.library_dirs, ['three', 'four']) self.assertEqual(cmd.library_dirs, ['three', 'four'])
def test_clean(self): def test_clean(self):
# _clean removes files # _clean removes files
......
...@@ -89,7 +89,7 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase): ...@@ -89,7 +89,7 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
with captured_stdout() as stdout: with captured_stdout() as stdout:
distutils.core.setup(name='bar') distutils.core.setup(name='bar')
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), 'bar\n') self.assertEqual(stdout.read(), 'bar\n')
distutils.core.DEBUG = True distutils.core.DEBUG = True
try: try:
...@@ -99,7 +99,7 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase): ...@@ -99,7 +99,7 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
distutils.core.DEBUG = False distutils.core.DEBUG = False
stdout.seek(0) stdout.seek(0)
wanted = "options (after parsing config files):\n" wanted = "options (after parsing config files):\n"
self.assertEquals(stdout.readlines()[0], wanted) self.assertEqual(stdout.readlines()[0], wanted)
def test_suite(): def test_suite():
return unittest.makeSuite(CoreTestCase) return unittest.makeSuite(CoreTestCase)
......
...@@ -42,7 +42,7 @@ class DepUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -42,7 +42,7 @@ class DepUtilTestCase(support.TempdirManager, unittest.TestCase):
self.write_file(two) self.write_file(two)
self.write_file(four) self.write_file(four)
self.assertEquals(newer_pairwise([one, two], [three, four]), self.assertEqual(newer_pairwise([one, two], [three, four]),
([one],[three])) ([one],[three]))
def test_newer_group(self): def test_newer_group(self):
......
...@@ -37,18 +37,18 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -37,18 +37,18 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
mkpath(self.target, verbose=0) mkpath(self.target, verbose=0)
wanted = [] wanted = []
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
remove_tree(self.root_target, verbose=0) remove_tree(self.root_target, verbose=0)
mkpath(self.target, verbose=1) mkpath(self.target, verbose=1)
wanted = ['creating %s' % self.root_target, wanted = ['creating %s' % self.root_target,
'creating %s' % self.target] 'creating %s' % self.target]
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
self._logs = [] self._logs = []
remove_tree(self.root_target, verbose=1) remove_tree(self.root_target, verbose=1)
wanted = ["removing '%s' (and everything under it)" % self.root_target] wanted = ["removing '%s' (and everything under it)" % self.root_target]
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
@unittest.skipIf(sys.platform.startswith('win'), @unittest.skipIf(sys.platform.startswith('win'),
"This test is only appropriate for POSIX-like systems.") "This test is only appropriate for POSIX-like systems.")
...@@ -66,12 +66,12 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -66,12 +66,12 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
def test_create_tree_verbosity(self): def test_create_tree_verbosity(self):
create_tree(self.root_target, ['one', 'two', 'three'], verbose=0) create_tree(self.root_target, ['one', 'two', 'three'], verbose=0)
self.assertEquals(self._logs, []) self.assertEqual(self._logs, [])
remove_tree(self.root_target, verbose=0) remove_tree(self.root_target, verbose=0)
wanted = ['creating %s' % self.root_target] wanted = ['creating %s' % self.root_target]
create_tree(self.root_target, ['one', 'two', 'three'], verbose=1) create_tree(self.root_target, ['one', 'two', 'three'], verbose=1)
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
remove_tree(self.root_target, verbose=0) remove_tree(self.root_target, verbose=0)
...@@ -81,7 +81,7 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -81,7 +81,7 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
mkpath(self.target, verbose=0) mkpath(self.target, verbose=0)
copy_tree(self.target, self.target2, verbose=0) copy_tree(self.target, self.target2, verbose=0)
self.assertEquals(self._logs, []) self.assertEqual(self._logs, [])
remove_tree(self.root_target, verbose=0) remove_tree(self.root_target, verbose=0)
...@@ -95,18 +95,18 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -95,18 +95,18 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
wanted = ['copying %s -> %s' % (a_file, self.target2)] wanted = ['copying %s -> %s' % (a_file, self.target2)]
copy_tree(self.target, self.target2, verbose=1) copy_tree(self.target, self.target2, verbose=1)
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
remove_tree(self.root_target, verbose=0) remove_tree(self.root_target, verbose=0)
remove_tree(self.target2, verbose=0) remove_tree(self.target2, verbose=0)
def test_ensure_relative(self): def test_ensure_relative(self):
if os.sep == '/': if os.sep == '/':
self.assertEquals(ensure_relative('/home/foo'), 'home/foo') self.assertEqual(ensure_relative('/home/foo'), 'home/foo')
self.assertEquals(ensure_relative('some/path'), 'some/path') self.assertEqual(ensure_relative('some/path'), 'some/path')
else: # \\ else: # \\
self.assertEquals(ensure_relative('c:\\home\\foo'), 'c:home\\foo') self.assertEqual(ensure_relative('c:\\home\\foo'), 'c:home\\foo')
self.assertEquals(ensure_relative('home\\foo'), 'home\\foo') self.assertEqual(ensure_relative('home\\foo'), 'home\\foo')
def test_suite(): def test_suite():
return unittest.makeSuite(DirUtilTestCase) return unittest.makeSuite(DirUtilTestCase)
......
...@@ -70,13 +70,13 @@ class DistributionTestCase(support.TempdirManager, ...@@ -70,13 +70,13 @@ class DistributionTestCase(support.TempdirManager,
with captured_stdout() as stdout: with captured_stdout() as stdout:
self.create_distribution(files) self.create_distribution(files)
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), '') self.assertEqual(stdout.read(), '')
distutils.dist.DEBUG = True distutils.dist.DEBUG = True
try: try:
with captured_stdout() as stdout: with captured_stdout() as stdout:
self.create_distribution(files) self.create_distribution(files)
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), '') self.assertEqual(stdout.read(), '')
finally: finally:
distutils.dist.DEBUG = False distutils.dist.DEBUG = False
...@@ -175,7 +175,7 @@ class DistributionTestCase(support.TempdirManager, ...@@ -175,7 +175,7 @@ class DistributionTestCase(support.TempdirManager,
finally: finally:
warnings.warn = old_warn warnings.warn = old_warn
self.assertEquals(len(warns), 0) self.assertEqual(len(warns), 0)
def test_finalize_options(self): def test_finalize_options(self):
...@@ -186,20 +186,20 @@ class DistributionTestCase(support.TempdirManager, ...@@ -186,20 +186,20 @@ class DistributionTestCase(support.TempdirManager,
dist.finalize_options() dist.finalize_options()
# finalize_option splits platforms and keywords # finalize_option splits platforms and keywords
self.assertEquals(dist.metadata.platforms, ['one', 'two']) self.assertEqual(dist.metadata.platforms, ['one', 'two'])
self.assertEquals(dist.metadata.keywords, ['one', 'two']) self.assertEqual(dist.metadata.keywords, ['one', 'two'])
def test_get_command_packages(self): def test_get_command_packages(self):
dist = Distribution() dist = Distribution()
self.assertEquals(dist.command_packages, None) self.assertEqual(dist.command_packages, None)
cmds = dist.get_command_packages() cmds = dist.get_command_packages()
self.assertEquals(cmds, ['distutils.command']) self.assertEqual(cmds, ['distutils.command'])
self.assertEquals(dist.command_packages, self.assertEqual(dist.command_packages,
['distutils.command']) ['distutils.command'])
dist.command_packages = 'one,two' dist.command_packages = 'one,two'
cmds = dist.get_command_packages() cmds = dist.get_command_packages()
self.assertEquals(cmds, ['distutils.command', 'one', 'two']) self.assertEqual(cmds, ['distutils.command', 'one', 'two'])
def test_announce(self): def test_announce(self):
...@@ -236,7 +236,7 @@ class DistributionTestCase(support.TempdirManager, ...@@ -236,7 +236,7 @@ class DistributionTestCase(support.TempdirManager,
os.path.expanduser = old_expander os.path.expanduser = old_expander
# make sure --no-user-cfg disables the user cfg file # make sure --no-user-cfg disables the user cfg file
self.assertEquals(len(all_files)-1, len(files)) self.assertEqual(len(all_files)-1, len(files))
class MetadataTestCase(support.TempdirManager, support.EnvironGuard, class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
...@@ -368,8 +368,8 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, ...@@ -368,8 +368,8 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
def test_fix_help_options(self): def test_fix_help_options(self):
help_tuples = [('a', 'b', 'c', 'd'), (1, 2, 3, 4)] help_tuples = [('a', 'b', 'c', 'd'), (1, 2, 3, 4)]
fancy_options = fix_help_options(help_tuples) fancy_options = fix_help_options(help_tuples)
self.assertEquals(fancy_options[0], ('a', 'b', 'c')) self.assertEqual(fancy_options[0], ('a', 'b', 'c'))
self.assertEquals(fancy_options[1], (1, 2, 3)) self.assertEqual(fancy_options[1], (1, 2, 3))
def test_show_help(self): def test_show_help(self):
# smoke test, just makes sure some help is displayed # smoke test, just makes sure some help is displayed
...@@ -417,14 +417,14 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, ...@@ -417,14 +417,14 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
PKG_INFO.seek(0) PKG_INFO.seek(0)
metadata.read_pkg_file(PKG_INFO) metadata.read_pkg_file(PKG_INFO)
self.assertEquals(metadata.name, "package") self.assertEqual(metadata.name, "package")
self.assertEquals(metadata.version, "1.0") self.assertEqual(metadata.version, "1.0")
self.assertEquals(metadata.description, "xxx") self.assertEqual(metadata.description, "xxx")
self.assertEquals(metadata.download_url, 'http://example.com') self.assertEqual(metadata.download_url, 'http://example.com')
self.assertEquals(metadata.keywords, ['one', 'two']) self.assertEqual(metadata.keywords, ['one', 'two'])
self.assertEquals(metadata.platforms, ['UNKNOWN']) self.assertEqual(metadata.platforms, ['UNKNOWN'])
self.assertEquals(metadata.obsoletes, None) self.assertEqual(metadata.obsoletes, None)
self.assertEquals(metadata.requires, ['foo']) self.assertEqual(metadata.requires, ['foo'])
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
...@@ -38,14 +38,14 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -38,14 +38,14 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
move_file(self.source, self.target, verbose=0) move_file(self.source, self.target, verbose=0)
wanted = [] wanted = []
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
# back to original state # back to original state
move_file(self.target, self.source, verbose=0) move_file(self.target, self.source, verbose=0)
move_file(self.source, self.target, verbose=1) move_file(self.source, self.target, verbose=1)
wanted = ['moving %s -> %s' % (self.source, self.target)] wanted = ['moving %s -> %s' % (self.source, self.target)]
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
# back to original state # back to original state
move_file(self.target, self.source, verbose=0) move_file(self.target, self.source, verbose=0)
...@@ -55,7 +55,7 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -55,7 +55,7 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
os.mkdir(self.target_dir) os.mkdir(self.target_dir)
move_file(self.source, self.target_dir, verbose=1) move_file(self.source, self.target_dir, verbose=1)
wanted = ['moving %s -> %s' % (self.source, self.target_dir)] wanted = ['moving %s -> %s' % (self.source, self.target_dir)]
self.assertEquals(self._logs, wanted) self.assertEqual(self._logs, wanted)
def test_write_file(self): def test_write_file(self):
lines = ['a', 'b', 'c'] lines = ['a', 'b', 'c']
...@@ -63,7 +63,7 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase): ...@@ -63,7 +63,7 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
foo = os.path.join(dir, 'foo') foo = os.path.join(dir, 'foo')
write_file(foo, lines) write_file(foo, lines)
content = [line.strip() for line in open(foo).readlines()] content = [line.strip() for line in open(foo).readlines()]
self.assertEquals(content, lines) self.assertEqual(content, lines)
def test_copy_file(self): def test_copy_file(self):
src_dir = self.mkdtemp() src_dir = self.mkdtemp()
......
...@@ -24,15 +24,15 @@ class FileListTestCase(unittest.TestCase): ...@@ -24,15 +24,15 @@ class FileListTestCase(unittest.TestCase):
def test_glob_to_re(self): def test_glob_to_re(self):
# simple cases # simple cases
self.assertEquals(glob_to_re('foo*'), 'foo[^/]*\\Z(?ms)') self.assertEqual(glob_to_re('foo*'), 'foo[^/]*\\Z(?ms)')
self.assertEquals(glob_to_re('foo?'), 'foo[^/]\\Z(?ms)') self.assertEqual(glob_to_re('foo?'), 'foo[^/]\\Z(?ms)')
self.assertEquals(glob_to_re('foo??'), 'foo[^/][^/]\\Z(?ms)') self.assertEqual(glob_to_re('foo??'), 'foo[^/][^/]\\Z(?ms)')
# special cases # special cases
self.assertEquals(glob_to_re(r'foo\\*'), r'foo\\\\[^/]*\Z(?ms)') self.assertEqual(glob_to_re(r'foo\\*'), r'foo\\\\[^/]*\Z(?ms)')
self.assertEquals(glob_to_re(r'foo\\\*'), r'foo\\\\\\[^/]*\Z(?ms)') self.assertEqual(glob_to_re(r'foo\\\*'), r'foo\\\\\\[^/]*\Z(?ms)')
self.assertEquals(glob_to_re('foo????'), r'foo[^/][^/][^/][^/]\Z(?ms)') self.assertEqual(glob_to_re('foo????'), r'foo[^/][^/][^/][^/]\Z(?ms)')
self.assertEquals(glob_to_re(r'foo\\??'), r'foo\\\\[^/][^/]\Z(?ms)') self.assertEqual(glob_to_re(r'foo\\??'), r'foo\\\\[^/][^/]\Z(?ms)')
def test_process_template_line(self): def test_process_template_line(self):
# testing all MANIFEST.in template patterns # testing all MANIFEST.in template patterns
...@@ -60,21 +60,21 @@ class FileListTestCase(unittest.TestCase): ...@@ -60,21 +60,21 @@ class FileListTestCase(unittest.TestCase):
join('global', 'two.txt'), join('f', 'o', 'f.oo'), join('global', 'two.txt'), join('f', 'o', 'f.oo'),
join('dir', 'graft-one'), join('dir', 'dir2', 'graft2')] join('dir', 'graft-one'), join('dir', 'dir2', 'graft2')]
self.assertEquals(file_list.files, wanted) self.assertEqual(file_list.files, wanted)
def test_debug_print(self): def test_debug_print(self):
file_list = FileList() file_list = FileList()
with captured_stdout() as stdout: with captured_stdout() as stdout:
file_list.debug_print('xxx') file_list.debug_print('xxx')
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), '') self.assertEqual(stdout.read(), '')
debug.DEBUG = True debug.DEBUG = True
try: try:
with captured_stdout() as stdout: with captured_stdout() as stdout:
file_list.debug_print('xxx') file_list.debug_print('xxx')
stdout.seek(0) stdout.seek(0)
self.assertEquals(stdout.read(), 'xxx\n') self.assertEqual(stdout.read(), 'xxx\n')
finally: finally:
debug.DEBUG = False debug.DEBUG = False
......
...@@ -27,14 +27,14 @@ class InstallDataTestCase(support.TempdirManager, ...@@ -27,14 +27,14 @@ class InstallDataTestCase(support.TempdirManager,
self.write_file(two, 'xxx') self.write_file(two, 'xxx')
cmd.data_files = [one, (inst2, [two])] cmd.data_files = [one, (inst2, [two])]
self.assertEquals(cmd.get_inputs(), [one, (inst2, [two])]) self.assertEqual(cmd.get_inputs(), [one, (inst2, [two])])
# let's run the command # let's run the command
cmd.ensure_finalized() cmd.ensure_finalized()
cmd.run() cmd.run()
# let's check the result # let's check the result
self.assertEquals(len(cmd.get_outputs()), 2) self.assertEqual(len(cmd.get_outputs()), 2)
rtwo = os.path.split(two)[-1] rtwo = os.path.split(two)[-1]
self.assertTrue(os.path.exists(os.path.join(inst2, rtwo))) self.assertTrue(os.path.exists(os.path.join(inst2, rtwo)))
rone = os.path.split(one)[-1] rone = os.path.split(one)[-1]
...@@ -47,7 +47,7 @@ class InstallDataTestCase(support.TempdirManager, ...@@ -47,7 +47,7 @@ class InstallDataTestCase(support.TempdirManager,
cmd.run() cmd.run()
# let's check the result # let's check the result
self.assertEquals(len(cmd.get_outputs()), 2) self.assertEqual(len(cmd.get_outputs()), 2)
self.assertTrue(os.path.exists(os.path.join(inst2, rtwo))) self.assertTrue(os.path.exists(os.path.join(inst2, rtwo)))
self.assertTrue(os.path.exists(os.path.join(inst, rone))) self.assertTrue(os.path.exists(os.path.join(inst, rone)))
cmd.outfiles = [] cmd.outfiles = []
...@@ -65,7 +65,7 @@ class InstallDataTestCase(support.TempdirManager, ...@@ -65,7 +65,7 @@ class InstallDataTestCase(support.TempdirManager,
cmd.run() cmd.run()
# let's check the result # let's check the result
self.assertEquals(len(cmd.get_outputs()), 4) self.assertEqual(len(cmd.get_outputs()), 4)
self.assertTrue(os.path.exists(os.path.join(inst2, rtwo))) self.assertTrue(os.path.exists(os.path.join(inst2, rtwo)))
self.assertTrue(os.path.exists(os.path.join(inst, rone))) self.assertTrue(os.path.exists(os.path.join(inst, rone)))
......
...@@ -23,7 +23,7 @@ class InstallHeadersTestCase(support.TempdirManager, ...@@ -23,7 +23,7 @@ class InstallHeadersTestCase(support.TempdirManager,
pkg_dir, dist = self.create_dist(headers=headers) pkg_dir, dist = self.create_dist(headers=headers)
cmd = install_headers(dist) cmd = install_headers(dist)
self.assertEquals(cmd.get_inputs(), headers) self.assertEqual(cmd.get_inputs(), headers)
# let's run the command # let's run the command
cmd.install_dir = os.path.join(pkg_dir, 'inst') cmd.install_dir = os.path.join(pkg_dir, 'inst')
...@@ -31,7 +31,7 @@ class InstallHeadersTestCase(support.TempdirManager, ...@@ -31,7 +31,7 @@ class InstallHeadersTestCase(support.TempdirManager,
cmd.run() cmd.run()
# let's check the results # let's check the results
self.assertEquals(len(cmd.get_outputs()), 2) self.assertEqual(len(cmd.get_outputs()), 2)
def test_suite(): def test_suite():
return unittest.makeSuite(InstallHeadersTestCase) return unittest.makeSuite(InstallHeadersTestCase)
......
...@@ -18,8 +18,8 @@ class InstallLibTestCase(support.TempdirManager, ...@@ -18,8 +18,8 @@ class InstallLibTestCase(support.TempdirManager,
cmd = install_lib(dist) cmd = install_lib(dist)
cmd.finalize_options() cmd.finalize_options()
self.assertEquals(cmd.compile, 1) self.assertEqual(cmd.compile, 1)
self.assertEquals(cmd.optimize, 0) self.assertEqual(cmd.optimize, 0)
# optimize must be 0, 1, or 2 # optimize must be 0, 1, or 2
cmd.optimize = 'foo' cmd.optimize = 'foo'
...@@ -29,7 +29,7 @@ class InstallLibTestCase(support.TempdirManager, ...@@ -29,7 +29,7 @@ class InstallLibTestCase(support.TempdirManager,
cmd.optimize = '2' cmd.optimize = '2'
cmd.finalize_options() cmd.finalize_options()
self.assertEquals(cmd.optimize, 2) self.assertEqual(cmd.optimize, 2)
def _setup_byte_compile(self): def _setup_byte_compile(self):
pkg_dir, dist = self.create_dist() pkg_dir, dist = self.create_dist()
...@@ -81,7 +81,7 @@ class InstallLibTestCase(support.TempdirManager, ...@@ -81,7 +81,7 @@ class InstallLibTestCase(support.TempdirManager,
cmd.distribution.script_name = 'setup.py' cmd.distribution.script_name = 'setup.py'
# get_input should return 2 elements # get_input should return 2 elements
self.assertEquals(len(cmd.get_inputs()), 2) self.assertEqual(len(cmd.get_inputs()), 2)
def test_dont_write_bytecode(self): def test_dont_write_bytecode(self):
# makes sure byte_compile is not used # makes sure byte_compile is not used
......
...@@ -103,7 +103,7 @@ class msvc9compilerTestCase(support.TempdirManager, ...@@ -103,7 +103,7 @@ class msvc9compilerTestCase(support.TempdirManager,
import _winreg import _winreg
HKCU = _winreg.HKEY_CURRENT_USER HKCU = _winreg.HKEY_CURRENT_USER
keys = Reg.read_keys(HKCU, 'xxxx') keys = Reg.read_keys(HKCU, 'xxxx')
self.assertEquals(keys, None) self.assertEqual(keys, None)
keys = Reg.read_keys(HKCU, r'Control Panel') keys = Reg.read_keys(HKCU, r'Control Panel')
self.assertTrue('Desktop' in keys) self.assertTrue('Desktop' in keys)
...@@ -130,7 +130,7 @@ class msvc9compilerTestCase(support.TempdirManager, ...@@ -130,7 +130,7 @@ class msvc9compilerTestCase(support.TempdirManager,
f.close() f.close()
# makes sure the manifest was properly cleaned # makes sure the manifest was properly cleaned
self.assertEquals(content, _CLEANED_MANIFEST) self.assertEqual(content, _CLEANED_MANIFEST)
def test_suite(): def test_suite():
......
...@@ -122,7 +122,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): ...@@ -122,7 +122,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
f = open(self.rc) f = open(self.rc)
try: try:
content = f.read() content = f.read()
self.assertEquals(content, WANTED_PYPIRC) self.assertEqual(content, WANTED_PYPIRC)
finally: finally:
f.close() f.close()
...@@ -141,7 +141,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): ...@@ -141,7 +141,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
self.assertTrue(self.conn.reqs, 2) self.assertTrue(self.conn.reqs, 2)
req1 = dict(self.conn.reqs[0].headers) req1 = dict(self.conn.reqs[0].headers)
req2 = dict(self.conn.reqs[1].headers) req2 = dict(self.conn.reqs[1].headers)
self.assertEquals(req2['Content-length'], req1['Content-length']) self.assertEqual(req2['Content-length'], req1['Content-length'])
self.assertTrue('xxx' in self.conn.reqs[1].data) self.assertTrue('xxx' in self.conn.reqs[1].data)
def test_password_not_in_file(self): def test_password_not_in_file(self):
...@@ -154,7 +154,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): ...@@ -154,7 +154,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
# dist.password should be set # dist.password should be set
# therefore used afterwards by other commands # therefore used afterwards by other commands
self.assertEquals(cmd.distribution.password, 'password') self.assertEqual(cmd.distribution.password, 'password')
def test_registering(self): def test_registering(self):
# this test runs choice 2 # this test runs choice 2
...@@ -171,7 +171,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): ...@@ -171,7 +171,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
self.assertTrue(self.conn.reqs, 1) self.assertTrue(self.conn.reqs, 1)
req = self.conn.reqs[0] req = self.conn.reqs[0]
headers = dict(req.headers) headers = dict(req.headers)
self.assertEquals(headers['Content-length'], '608') self.assertEqual(headers['Content-length'], '608')
self.assertTrue('tarek' in req.data) self.assertTrue('tarek' in req.data)
def test_password_reset(self): def test_password_reset(self):
...@@ -189,7 +189,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): ...@@ -189,7 +189,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
self.assertTrue(self.conn.reqs, 1) self.assertTrue(self.conn.reqs, 1)
req = self.conn.reqs[0] req = self.conn.reqs[0]
headers = dict(req.headers) headers = dict(req.headers)
self.assertEquals(headers['Content-length'], '290') self.assertEqual(headers['Content-length'], '290')
self.assertTrue('tarek' in req.data) self.assertTrue('tarek' in req.data)
def test_strict(self): def test_strict(self):
...@@ -252,7 +252,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): ...@@ -252,7 +252,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
with check_warnings() as w: with check_warnings() as w:
warnings.simplefilter("always") warnings.simplefilter("always")
cmd.check_metadata() cmd.check_metadata()
self.assertEquals(len(w.warnings), 1) self.assertEqual(len(w.warnings), 1)
def test_suite(): def test_suite():
return unittest.makeSuite(RegisterTestCase) return unittest.makeSuite(RegisterTestCase)
......
...@@ -127,7 +127,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -127,7 +127,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
# now let's check what we have # now let's check what we have
dist_folder = join(self.tmp_dir, 'dist') dist_folder = join(self.tmp_dir, 'dist')
files = os.listdir(dist_folder) files = os.listdir(dist_folder)
self.assertEquals(files, ['fake-1.0.zip']) self.assertEqual(files, ['fake-1.0.zip'])
zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip')) zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip'))
try: try:
...@@ -136,7 +136,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -136,7 +136,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
zip_file.close() zip_file.close()
# making sure everything has been pruned correctly # making sure everything has been pruned correctly
self.assertEquals(len(content), 4) self.assertEqual(len(content), 4)
@unittest.skipUnless(zlib, "requires zlib") @unittest.skipUnless(zlib, "requires zlib")
def test_make_distribution(self): def test_make_distribution(self):
...@@ -158,8 +158,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -158,8 +158,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
dist_folder = join(self.tmp_dir, 'dist') dist_folder = join(self.tmp_dir, 'dist')
result = os.listdir(dist_folder) result = os.listdir(dist_folder)
result.sort() result.sort()
self.assertEquals(result, self.assertEqual(result, ['fake-1.0.tar', 'fake-1.0.tar.gz'] )
['fake-1.0.tar', 'fake-1.0.tar.gz'] )
os.remove(join(dist_folder, 'fake-1.0.tar')) os.remove(join(dist_folder, 'fake-1.0.tar'))
os.remove(join(dist_folder, 'fake-1.0.tar.gz')) os.remove(join(dist_folder, 'fake-1.0.tar.gz'))
...@@ -172,8 +171,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -172,8 +171,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
result = os.listdir(dist_folder) result = os.listdir(dist_folder)
result.sort() result.sort()
self.assertEquals(result, self.assertEqual(result, ['fake-1.0.tar', 'fake-1.0.tar.gz'])
['fake-1.0.tar', 'fake-1.0.tar.gz'])
@unittest.skipUnless(zlib, "requires zlib") @unittest.skipUnless(zlib, "requires zlib")
def test_add_defaults(self): def test_add_defaults(self):
...@@ -222,7 +220,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -222,7 +220,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
# now let's check what we have # now let's check what we have
dist_folder = join(self.tmp_dir, 'dist') dist_folder = join(self.tmp_dir, 'dist')
files = os.listdir(dist_folder) files = os.listdir(dist_folder)
self.assertEquals(files, ['fake-1.0.zip']) self.assertEqual(files, ['fake-1.0.zip'])
zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip')) zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip'))
try: try:
...@@ -231,13 +229,13 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -231,13 +229,13 @@ class SDistTestCase(PyPIRCCommandTestCase):
zip_file.close() zip_file.close()
# making sure everything was added # making sure everything was added
self.assertEquals(len(content), 11) self.assertEqual(len(content), 11)
# checking the MANIFEST # checking the MANIFEST
f = open(join(self.tmp_dir, 'MANIFEST')) f = open(join(self.tmp_dir, 'MANIFEST'))
try: try:
manifest = f.read() manifest = f.read()
self.assertEquals(manifest, MANIFEST % {'sep': os.sep}) self.assertEqual(manifest, MANIFEST % {'sep': os.sep})
finally: finally:
f.close() f.close()
...@@ -251,7 +249,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -251,7 +249,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
cmd.ensure_finalized() cmd.ensure_finalized()
cmd.run() cmd.run()
warnings = self.get_logs(WARN) warnings = self.get_logs(WARN)
self.assertEquals(len(warnings), 2) self.assertEqual(len(warnings), 2)
# trying with a complete set of metadata # trying with a complete set of metadata
self.clear_logs() self.clear_logs()
...@@ -260,7 +258,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -260,7 +258,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
cmd.metadata_check = 0 cmd.metadata_check = 0
cmd.run() cmd.run()
warnings = self.get_logs(WARN) warnings = self.get_logs(WARN)
self.assertEquals(len(warnings), 0) self.assertEqual(len(warnings), 0)
def test_check_metadata_deprecated(self): def test_check_metadata_deprecated(self):
# makes sure make_metadata is deprecated # makes sure make_metadata is deprecated
...@@ -268,7 +266,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -268,7 +266,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
with check_warnings() as w: with check_warnings() as w:
warnings.simplefilter("always") warnings.simplefilter("always")
cmd.check_metadata() cmd.check_metadata()
self.assertEquals(len(w.warnings), 1) self.assertEqual(len(w.warnings), 1)
def test_show_formats(self): def test_show_formats(self):
with captured_stdout() as stdout: with captured_stdout() as stdout:
...@@ -278,7 +276,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -278,7 +276,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
num_formats = len(ARCHIVE_FORMATS.keys()) num_formats = len(ARCHIVE_FORMATS.keys())
output = [line for line in stdout.getvalue().split('\n') output = [line for line in stdout.getvalue().split('\n')
if line.strip().startswith('--formats=')] if line.strip().startswith('--formats=')]
self.assertEquals(len(output), num_formats) self.assertEqual(len(output), num_formats)
def test_finalize_options(self): def test_finalize_options(self):
...@@ -286,9 +284,9 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -286,9 +284,9 @@ class SDistTestCase(PyPIRCCommandTestCase):
cmd.finalize_options() cmd.finalize_options()
# default options set by finalize # default options set by finalize
self.assertEquals(cmd.manifest, 'MANIFEST') self.assertEqual(cmd.manifest, 'MANIFEST')
self.assertEquals(cmd.template, 'MANIFEST.in') self.assertEqual(cmd.template, 'MANIFEST.in')
self.assertEquals(cmd.dist_dir, 'dist') self.assertEqual(cmd.dist_dir, 'dist')
# formats has to be a string splitable on (' ', ',') or # formats has to be a string splitable on (' ', ',') or
# a stringlist # a stringlist
...@@ -325,8 +323,8 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -325,8 +323,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
archive = tarfile.open(archive_name) archive = tarfile.open(archive_name)
try: try:
for member in archive.getmembers(): for member in archive.getmembers():
self.assertEquals(member.uid, 0) self.assertEqual(member.uid, 0)
self.assertEquals(member.gid, 0) self.assertEqual(member.gid, 0)
finally: finally:
archive.close() archive.close()
...@@ -347,7 +345,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -347,7 +345,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
# rights (see #7408) # rights (see #7408)
try: try:
for member in archive.getmembers(): for member in archive.getmembers():
self.assertEquals(member.uid, os.getuid()) self.assertEqual(member.uid, os.getuid())
finally: finally:
archive.close() archive.close()
...@@ -369,7 +367,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -369,7 +367,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
finally: finally:
f.close() f.close()
self.assertEquals(len(manifest), 5) self.assertEqual(len(manifest), 5)
# adding a file # adding a file
self.write_file((self.tmp_dir, 'somecode', 'doc2.txt'), '#') self.write_file((self.tmp_dir, 'somecode', 'doc2.txt'), '#')
...@@ -389,7 +387,7 @@ class SDistTestCase(PyPIRCCommandTestCase): ...@@ -389,7 +387,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
f.close() f.close()
# do we have the new file in MANIFEST ? # do we have the new file in MANIFEST ?
self.assertEquals(len(manifest2), 6) self.assertEqual(len(manifest2), 6)
self.assertIn('doc2.txt', manifest2[-1]) self.assertIn('doc2.txt', manifest2[-1])
def test_manifest_marker(self): def test_manifest_marker(self):
......
...@@ -20,7 +20,7 @@ class SpawnTestCase(support.TempdirManager, ...@@ -20,7 +20,7 @@ class SpawnTestCase(support.TempdirManager,
(['nochange', 'nospace'], (['nochange', 'nospace'],
['nochange', 'nospace'])): ['nochange', 'nospace'])):
res = _nt_quote_args(args) res = _nt_quote_args(args)
self.assertEquals(res, wanted) self.assertEqual(res, wanted)
@unittest.skipUnless(os.name in ('nt', 'posix'), @unittest.skipUnless(os.name in ('nt', 'posix'),
......
...@@ -36,7 +36,7 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -36,7 +36,7 @@ class SysconfigTestCase(support.EnvironGuard,
sysconfig.get_python_lib(prefix=TESTFN)) sysconfig.get_python_lib(prefix=TESTFN))
_sysconfig = __import__('sysconfig') _sysconfig = __import__('sysconfig')
res = sysconfig.get_python_lib(True, True) res = sysconfig.get_python_lib(True, True)
self.assertEquals(_sysconfig.get_path('platstdlib'), res) self.assertEqual(_sysconfig.get_path('platstdlib'), res)
def test_get_python_inc(self): def test_get_python_inc(self):
inc_dir = sysconfig.get_python_inc() inc_dir = sysconfig.get_python_inc()
...@@ -56,7 +56,7 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -56,7 +56,7 @@ class SysconfigTestCase(support.EnvironGuard,
finally: finally:
fd.close() fd.close()
d = sysconfig.parse_makefile(self.makefile) d = sysconfig.parse_makefile(self.makefile)
self.assertEquals(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", self.assertEqual(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'",
'OTHER': 'foo'}) 'OTHER': 'foo'})
def test_parse_makefile_literal_dollar(self): def test_parse_makefile_literal_dollar(self):
...@@ -68,7 +68,7 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -68,7 +68,7 @@ class SysconfigTestCase(support.EnvironGuard,
finally: finally:
fd.close() fd.close()
d = sysconfig.parse_makefile(self.makefile) d = sysconfig.parse_makefile(self.makefile)
self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", self.assertEqual(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'",
'OTHER': 'foo'}) 'OTHER': 'foo'})
......
...@@ -48,7 +48,7 @@ class TextFileTestCase(support.TempdirManager, unittest.TestCase): ...@@ -48,7 +48,7 @@ class TextFileTestCase(support.TempdirManager, unittest.TestCase):
def test_input(count, description, file, expected_result): def test_input(count, description, file, expected_result):
result = file.readlines() result = file.readlines()
self.assertEquals(result, expected_result) self.assertEqual(result, expected_result)
tmpdir = self.mkdtemp() tmpdir = self.mkdtemp()
filename = os.path.join(tmpdir, "test.txt") filename = os.path.join(tmpdir, "test.txt")
......
...@@ -80,7 +80,7 @@ class uploadTestCase(PyPIRCCommandTestCase): ...@@ -80,7 +80,7 @@ class uploadTestCase(PyPIRCCommandTestCase):
for attr, waited in (('username', 'me'), ('password', 'secret'), for attr, waited in (('username', 'me'), ('password', 'secret'),
('realm', 'pypi'), ('realm', 'pypi'),
('repository', 'http://pypi.python.org/pypi')): ('repository', 'http://pypi.python.org/pypi')):
self.assertEquals(getattr(cmd, attr), waited) self.assertEqual(getattr(cmd, attr), waited)
def test_saved_password(self): def test_saved_password(self):
# file with no password # file with no password
...@@ -90,14 +90,14 @@ class uploadTestCase(PyPIRCCommandTestCase): ...@@ -90,14 +90,14 @@ class uploadTestCase(PyPIRCCommandTestCase):
dist = Distribution() dist = Distribution()
cmd = upload(dist) cmd = upload(dist)
cmd.finalize_options() cmd.finalize_options()
self.assertEquals(cmd.password, None) self.assertEqual(cmd.password, None)
# make sure we get it as well, if another command # make sure we get it as well, if another command
# initialized it at the dist level # initialized it at the dist level
dist.password = 'xxx' dist.password = 'xxx'
cmd = upload(dist) cmd = upload(dist)
cmd.finalize_options() cmd.finalize_options()
self.assertEquals(cmd.password, 'xxx') self.assertEqual(cmd.password, 'xxx')
def test_upload(self): def test_upload(self):
tmp = self.mkdtemp() tmp = self.mkdtemp()
...@@ -116,10 +116,10 @@ class uploadTestCase(PyPIRCCommandTestCase): ...@@ -116,10 +116,10 @@ class uploadTestCase(PyPIRCCommandTestCase):
# what did we send ? # what did we send ?
self.assertIn('dédé', self.last_open.req.data) self.assertIn('dédé', self.last_open.req.data)
headers = dict(self.last_open.req.headers) headers = dict(self.last_open.req.headers)
self.assertEquals(headers['Content-length'], '2085') self.assertEqual(headers['Content-length'], '2085')
self.assertTrue(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.assertEqual(self.last_open.req.get_method(), 'POST')
self.assertEquals(self.last_open.req.get_full_url(), self.assertEqual(self.last_open.req.get_full_url(),
'http://pypi.python.org/pypi') 'http://pypi.python.org/pypi')
self.assertTrue('xxx' in self.last_open.req.data) self.assertTrue('xxx' in self.last_open.req.data)
auth = self.last_open.req.headers['Authorization'] auth = self.last_open.req.headers['Authorization']
......
...@@ -7,12 +7,12 @@ class VersionTestCase(unittest.TestCase): ...@@ -7,12 +7,12 @@ class VersionTestCase(unittest.TestCase):
def test_prerelease(self): def test_prerelease(self):
version = StrictVersion('1.2.3a1') version = StrictVersion('1.2.3a1')
self.assertEquals(version.version, (1, 2, 3)) self.assertEqual(version.version, (1, 2, 3))
self.assertEquals(version.prerelease, ('a', 1)) self.assertEqual(version.prerelease, ('a', 1))
self.assertEquals(str(version), '1.2.3a1') self.assertEqual(str(version), '1.2.3a1')
version = StrictVersion('1.2.0') version = StrictVersion('1.2.0')
self.assertEquals(str(version), '1.2') self.assertEqual(str(version), '1.2')
def test_cmp_strict(self): def test_cmp_strict(self):
versions = (('1.5.1', '1.5.2b2', -1), versions = (('1.5.1', '1.5.2b2', -1),
...@@ -41,7 +41,7 @@ class VersionTestCase(unittest.TestCase): ...@@ -41,7 +41,7 @@ class VersionTestCase(unittest.TestCase):
raise AssertionError(("cmp(%s, %s) " raise AssertionError(("cmp(%s, %s) "
"shouldn't raise ValueError") "shouldn't raise ValueError")
% (v1, v2)) % (v1, v2))
self.assertEquals(res, wanted, self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' % 'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res)) (v1, v2, wanted, res))
...@@ -59,7 +59,7 @@ class VersionTestCase(unittest.TestCase): ...@@ -59,7 +59,7 @@ class VersionTestCase(unittest.TestCase):
for v1, v2, wanted in versions: for v1, v2, wanted in versions:
res = LooseVersion(v1).__cmp__(LooseVersion(v2)) res = LooseVersion(v1).__cmp__(LooseVersion(v2))
self.assertEquals(res, wanted, self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' % 'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res)) (v1, v2, wanted, res))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment