Use assertTrue and assertFalse instead of deprecated failUnless and failIf.

--HG--
branch : distribute
extra : rebase_source : 51c527a19483fc1b11084e4d2770d88015588822
parent 6695e537
......@@ -94,21 +94,21 @@ class DependsTests(TestCase):
from email import __version__
self.assertEqual(req.get_version(), __version__)
self.failUnless(req.version_ok('1.0.9'))
self.failIf(req.version_ok('0.9.1'))
self.failIf(req.version_ok('unknown'))
self.assertTrue(req.version_ok('1.0.9'))
self.assertFalse(req.version_ok('0.9.1'))
self.assertFalse(req.version_ok('unknown'))
self.failUnless(req.is_present())
self.failUnless(req.is_current())
self.assertTrue(req.is_present())
self.assertTrue(req.is_current())
req = Require('Email 3000','03000','email',format=LooseVersion)
self.failUnless(req.is_present())
self.failIf(req.is_current())
self.failIf(req.version_ok('unknown'))
self.assertTrue(req.is_present())
self.assertFalse(req.is_current())
self.assertFalse(req.version_ok('unknown'))
req = Require('Do-what-I-mean','1.0','d-w-i-m')
self.failIf(req.is_present())
self.failIf(req.is_current())
self.assertFalse(req.is_present())
self.assertFalse(req.is_current())
req = Require('Tests', None, 'tests', homepage="http://example.com")
self.assertEqual(req.format, None)
......@@ -118,8 +118,8 @@ class DependsTests(TestCase):
self.assertEqual(req.homepage, 'http://example.com')
paths = [os.path.dirname(p) for p in __path__]
self.failUnless(req.is_present(paths))
self.failUnless(req.is_current(paths))
self.assertTrue(req.is_present(paths))
self.assertTrue(req.is_current(paths))
class DistroTests(TestCase):
......@@ -137,7 +137,7 @@ class DistroTests(TestCase):
def testDistroType(self):
self.failUnless(isinstance(self.dist,setuptools.dist.Distribution))
self.assertTrue(isinstance(self.dist,setuptools.dist.Distribution))
def testExcludePackage(self):
......@@ -189,17 +189,17 @@ class DistroTests(TestCase):
dist.exclude(packages=['a'], py_modules=['b'], ext_modules=[self.e2])
def testContents(self):
self.failUnless(self.dist.has_contents_for('a'))
self.assertTrue(self.dist.has_contents_for('a'))
self.dist.exclude_package('a')
self.failIf(self.dist.has_contents_for('a'))
self.assertFalse(self.dist.has_contents_for('a'))
self.failUnless(self.dist.has_contents_for('b'))
self.assertTrue(self.dist.has_contents_for('b'))
self.dist.exclude_package('b')
self.failIf(self.dist.has_contents_for('b'))
self.assertFalse(self.dist.has_contents_for('b'))
self.failUnless(self.dist.has_contents_for('c'))
self.assertTrue(self.dist.has_contents_for('c'))
self.dist.exclude_package('c')
self.failIf(self.dist.has_contents_for('c'))
self.assertFalse(self.dist.has_contents_for('c'))
......@@ -269,12 +269,12 @@ class FeatureTests(TestCase):
)
def testDefaults(self):
self.failIf(
self.assertFalse(
Feature(
"test",standard=True,remove='x',available=False
).include_by_default()
)
self.failUnless(
self.assertTrue(
Feature("test",standard=True,remove='x').include_by_default()
)
# Feature must have either kwargs, removes, or require_features
......@@ -288,33 +288,33 @@ class FeatureTests(TestCase):
def testFeatureOptions(self):
dist = self.dist
self.failUnless(
self.assertTrue(
('with-dwim',None,'include DWIM') in dist.feature_options
)
self.failUnless(
self.assertTrue(
('without-dwim',None,'exclude DWIM (default)') in dist.feature_options
)
self.failUnless(
self.assertTrue(
('with-bar',None,'include bar (default)') in dist.feature_options
)
self.failUnless(
self.assertTrue(
('without-bar',None,'exclude bar') in dist.feature_options
)
self.assertEqual(dist.feature_negopt['without-foo'],'with-foo')
self.assertEqual(dist.feature_negopt['without-bar'],'with-bar')
self.assertEqual(dist.feature_negopt['without-dwim'],'with-dwim')
self.failIf('without-baz' in dist.feature_negopt)
self.assertFalse('without-baz' in dist.feature_negopt)
def testUseFeatures(self):
dist = self.dist
self.assertEqual(dist.with_foo,1)
self.assertEqual(dist.with_bar,0)
self.assertEqual(dist.with_baz,1)
self.failIf('bar_et' in dist.py_modules)
self.failIf('pkg.bar' in dist.packages)
self.failUnless('pkg.baz' in dist.packages)
self.failUnless('scripts/baz_it' in dist.scripts)
self.failUnless(('libfoo','foo/foofoo.c') in dist.libraries)
self.assertFalse('bar_et' in dist.py_modules)
self.assertFalse('pkg.bar' in dist.packages)
self.assertTrue('pkg.baz' in dist.packages)
self.assertTrue('scripts/baz_it' in dist.scripts)
self.assertTrue(('libfoo','foo/foofoo.c') in dist.libraries)
self.assertEqual(dist.ext_modules,[])
self.assertEqual(dist.require_features, [self.req])
......@@ -331,7 +331,7 @@ class TestCommandTests(TestCase):
def testTestIsCommand(self):
test_cmd = makeSetup().get_command_obj('test')
self.failUnless(isinstance(test_cmd, distutils.cmd.Command))
self.assertTrue(isinstance(test_cmd, distutils.cmd.Command))
def testLongOptSuiteWNoDefault(self):
ts1 = makeSetup(script_args=['test','--test-suite=foo.tests.suite'])
......
......@@ -35,7 +35,7 @@ class DistroTests(TestCase):
ad.add(Distribution.from_filename("FooPkg-1.2-py2.4.egg"))
# Name is in there now
self.failUnless(ad['FooPkg'])
self.assertTrue(ad['FooPkg'])
# But only 1 package
self.assertEqual(list(ad), ['foopkg'])
......@@ -218,7 +218,7 @@ class EntryPointTests(TestCase):
self.assertEqual(ep.module_name,"setuptools.tests.test_resources")
self.assertEqual(ep.attrs, ("EntryPointTests",))
self.assertEqual(ep.extras, ("x",))
self.failUnless(ep.load() is EntryPointTests)
self.assertTrue(ep.load() is EntryPointTests)
self.assertEqual(
str(ep),
"foo = setuptools.tests.test_resources:EntryPointTests [x]"
......@@ -318,20 +318,20 @@ class RequirementsTests(TestCase):
foo_dist = Distribution.from_filename("FooPkg-1.3_1.egg")
twist11 = Distribution.from_filename("Twisted-1.1.egg")
twist12 = Distribution.from_filename("Twisted-1.2.egg")
self.failUnless(parse_version('1.2') in r)
self.failUnless(parse_version('1.1') not in r)
self.failUnless('1.2' in r)
self.failUnless('1.1' not in r)
self.failUnless(foo_dist not in r)
self.failUnless(twist11 not in r)
self.failUnless(twist12 in r)
self.assertTrue(parse_version('1.2') in r)
self.assertTrue(parse_version('1.1') not in r)
self.assertTrue('1.2' in r)
self.assertTrue('1.1' not in r)
self.assertTrue(foo_dist not in r)
self.assertTrue(twist11 not in r)
self.assertTrue(twist12 in r)
def testAdvancedContains(self):
r, = parse_requirements("Foo>=1.2,<=1.3,==1.9,>2.0,!=2.5,<3.0,==4.5")
for v in ('1.2','1.2.2','1.3','1.9','2.0.1','2.3','2.6','3.0c1','4.5'):
self.failUnless(v in r, (v,r))
self.assertTrue(v in r, (v,r))
for v in ('1.2c1','1.3.1','1.5','1.9.1','2.0','2.5','3.0','4.0'):
self.failUnless(v not in r, (v,r))
self.assertTrue(v not in r, (v,r))
def testOptionsAndHashing(self):
......@@ -353,14 +353,14 @@ class RequirementsTests(TestCase):
r2 = Requirement.parse("foo!=0.3a4")
d = Distribution.from_filename
self.failIf(d("foo-0.3a4.egg") in r1)
self.failIf(d("foo-0.3a1.egg") in r1)
self.failIf(d("foo-0.3a4.egg") in r2)
self.assertFalse(d("foo-0.3a4.egg") in r1)
self.assertFalse(d("foo-0.3a1.egg") in r1)
self.assertFalse(d("foo-0.3a4.egg") in r2)
self.failUnless(d("foo-0.3a2.egg") in r1)
self.failUnless(d("foo-0.3a2.egg") in r2)
self.failUnless(d("foo-0.3a3.egg") in r2)
self.failUnless(d("foo-0.3a5.egg") in r2)
self.assertTrue(d("foo-0.3a2.egg") in r1)
self.assertTrue(d("foo-0.3a2.egg") in r2)
self.assertTrue(d("foo-0.3a3.egg") in r2)
self.assertTrue(d("foo-0.3a5.egg") in r2)
def testDistributeSetuptoolsOverride(self):
# Plain setuptools or distribute mean we return distribute.
......@@ -480,7 +480,7 @@ class ParseTests(TestCase):
def testVersionOrdering(self):
def c(s1,s2):
p1, p2 = parse_version(s1),parse_version(s2)
self.failUnless(p1<p2, (s1,s2,p1,p2))
self.assertTrue(p1<p2, (s1,s2,p1,p2))
c('2.1','2.1.1')
c('2a1','2b0')
......
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