mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Minor tweaks to packaging tests.
- Move a tearDown method right after setUp - Use assertRaises instead of reinventing it - Skip a test instead of commenting it out, as a reminder
This commit is contained in:
parent
c06f46f74c
commit
ed5d2f1310
3 changed files with 28 additions and 34 deletions
|
@ -37,6 +37,16 @@ class BuildExtTestCase(support.TempdirManager,
|
||||||
site.USER_BASE = self.mkdtemp()
|
site.USER_BASE = self.mkdtemp()
|
||||||
build_ext.USER_BASE = site.USER_BASE
|
build_ext.USER_BASE = site.USER_BASE
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
# Get everything back to normal
|
||||||
|
unload('xx')
|
||||||
|
sys.path.remove(self.tmp_dir)
|
||||||
|
if sys.version > "2.6":
|
||||||
|
site.USER_BASE = self.old_user_base
|
||||||
|
build_ext.USER_BASE = self.old_user_base
|
||||||
|
|
||||||
|
super(BuildExtTestCase, self).tearDown()
|
||||||
|
|
||||||
def _fixup_command(self, cmd):
|
def _fixup_command(self, cmd):
|
||||||
# When Python was build with --enable-shared, -L. is not good enough
|
# When Python was build with --enable-shared, -L. is not good enough
|
||||||
# to find the libpython<blah>.so. This is because regrtest runs it
|
# to find the libpython<blah>.so. This is because regrtest runs it
|
||||||
|
@ -103,16 +113,6 @@ class BuildExtTestCase(support.TempdirManager,
|
||||||
self.assertTrue(isinstance(xx.Null(), xx.Null))
|
self.assertTrue(isinstance(xx.Null(), xx.Null))
|
||||||
self.assertTrue(isinstance(xx.Str(), xx.Str))
|
self.assertTrue(isinstance(xx.Str(), xx.Str))
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
# Get everything back to normal
|
|
||||||
unload('xx')
|
|
||||||
sys.path.remove(self.tmp_dir)
|
|
||||||
if sys.version > "2.6":
|
|
||||||
site.USER_BASE = self.old_user_base
|
|
||||||
build_ext.USER_BASE = self.old_user_base
|
|
||||||
|
|
||||||
super(BuildExtTestCase, self).tearDown()
|
|
||||||
|
|
||||||
def test_solaris_enable_shared(self):
|
def test_solaris_enable_shared(self):
|
||||||
dist = Distribution({'name': 'xx'})
|
dist = Distribution({'name': 'xx'})
|
||||||
cmd = build_ext(dist)
|
cmd = build_ext(dist)
|
||||||
|
|
|
@ -239,7 +239,6 @@ class TestReleasesList(unittest.TestCase):
|
||||||
|
|
||||||
def test_prefer_final(self):
|
def test_prefer_final(self):
|
||||||
# Can order the distributions using prefer_final
|
# Can order the distributions using prefer_final
|
||||||
|
|
||||||
fb10 = ReleaseInfo("FooBar", "1.0") # final distribution
|
fb10 = ReleaseInfo("FooBar", "1.0") # final distribution
|
||||||
fb11a = ReleaseInfo("FooBar", "1.1a1") # alpha
|
fb11a = ReleaseInfo("FooBar", "1.1a1") # alpha
|
||||||
fb12a = ReleaseInfo("FooBar", "1.2a1") # alpha
|
fb12a = ReleaseInfo("FooBar", "1.2a1") # alpha
|
||||||
|
@ -252,22 +251,23 @@ class TestReleasesList(unittest.TestCase):
|
||||||
dists.sort_releases(prefer_final=False)
|
dists.sort_releases(prefer_final=False)
|
||||||
self.assertEqual(fb12b, dists[0])
|
self.assertEqual(fb12b, dists[0])
|
||||||
|
|
||||||
# def test_prefer_source(self):
|
@unittest.skip('method not implemented yet')
|
||||||
# # Ordering support prefer_source
|
def test_prefer_source(self):
|
||||||
# fb_source = Dist("FooBar", "1.0", type="source")
|
# Ordering supports prefer_source
|
||||||
# fb_binary = Dist("FooBar", "1.0", type="binary")
|
fb_source = Dist("FooBar", "1.0", type="source")
|
||||||
# fb2_binary = Dist("FooBar", "2.0", type="binary")
|
fb_binary = Dist("FooBar", "1.0", type="binary")
|
||||||
# dists = ReleasesList([fb_binary, fb_source])
|
fb2_binary = Dist("FooBar", "2.0", type="binary")
|
||||||
#
|
dists = ReleasesList([fb_binary, fb_source])
|
||||||
# dists.sort_distributions(prefer_source=True)
|
|
||||||
# self.assertEqual(fb_source, dists[0])
|
dists.sort_distributions(prefer_source=True)
|
||||||
#
|
self.assertEqual(fb_source, dists[0])
|
||||||
# dists.sort_distributions(prefer_source=False)
|
|
||||||
# self.assertEqual(fb_binary, dists[0])
|
dists.sort_distributions(prefer_source=False)
|
||||||
#
|
self.assertEqual(fb_binary, dists[0])
|
||||||
# dists.append(fb2_binary)
|
|
||||||
# dists.sort_distributions(prefer_source=True)
|
dists.append(fb2_binary)
|
||||||
# self.assertEqual(fb2_binary, dists[0])
|
dists.sort_distributions(prefer_source=True)
|
||||||
|
self.assertEqual(fb2_binary, dists[0])
|
||||||
|
|
||||||
def test_get_last(self):
|
def test_get_last(self):
|
||||||
dists = ReleasesList('Foo')
|
dists = ReleasesList('Foo')
|
||||||
|
|
|
@ -700,14 +700,8 @@ class GlobTestCase(GlobTestCaseBase):
|
||||||
'{a**a,babar}',
|
'{a**a,babar}',
|
||||||
'{bob,b**z}',
|
'{bob,b**z}',
|
||||||
]
|
]
|
||||||
msg = "%r is not supposed to be a valid pattern"
|
|
||||||
for pattern in invalids:
|
for pattern in invalids:
|
||||||
try:
|
self.assertRaises(ValueError, iglob, pattern)
|
||||||
iglob(pattern)
|
|
||||||
except ValueError:
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
self.fail(msg % pattern)
|
|
||||||
|
|
||||||
|
|
||||||
class EggInfoToDistInfoTestCase(support.TempdirManager,
|
class EggInfoToDistInfoTestCase(support.TempdirManager,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue