From: Éric Araujo Date: Fri, 17 Jun 2011 17:38:38 +0000 (+0200) Subject: Brange merge X-Git-Tag: v3.3.0a1~2102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74d68135adffce55cf96e62c0c71ab72945a7753;p=python Brange merge --- 74d68135adffce55cf96e62c0c71ab72945a7753 diff --cc Lib/packaging/tests/test_command_build_ext.py index 13bfeea5d9,930a38f4e8..8f61ce42e4 --- a/Lib/packaging/tests/test_command_build_ext.py +++ b/Lib/packaging/tests/test_command_build_ext.py @@@ -33,6 -37,16 +33,14 @@@ class BuildExtTestCase(support.TempdirM site.USER_BASE = self.mkdtemp() 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): # When Python was build with --enable-shared, -L. is not good enough # to find the libpython.so. This is because regrtest runs it @@@ -80,33 -95,24 +88,25 @@@ finally: sys.stdout = old_stdout - if ALREADY_TESTED: - return - else: - ALREADY_TESTED = True + code = """if 1: + import sys + sys.path.insert(0, %r) - import xx + import xx - for attr in ('error', 'foo', 'new', 'roj'): - self.assertTrue(hasattr(xx, attr)) + for attr in ('error', 'foo', 'new', 'roj'): + assert hasattr(xx, attr) - self.assertEqual(xx.foo(2, 5), 7) - self.assertEqual(xx.foo(13, 15), 28) - self.assertEqual(xx.new().demo(), None) - doc = 'This is a template module just for instruction.' - self.assertEqual(xx.__doc__, doc) - self.assertTrue(isinstance(xx.Null(), xx.Null)) - self.assertTrue(isinstance(xx.Str(), xx.Str)) + assert xx.foo(2, 5) == 7 + assert xx.foo(13, 15) == 28 + assert xx.new().demo() is None + doc = 'This is a template module just for instruction.' + assert xx.__doc__ == doc + assert isinstance(xx.Null(), xx.Null) + assert isinstance(xx.Str(), xx.Str)""" + code = code % self.tmp_dir + assert_python_ok('-c', code) - def tearDown(self): - # Get everything back to normal - 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): dist = Distribution({'name': 'xx'}) cmd = build_ext(dist)