Commit c6338dae authored by Christian Heimes's avatar Christian Heimes

Second fix for issue #4373

parent a122c288
...@@ -11,6 +11,10 @@ from distutils import sysconfig ...@@ -11,6 +11,10 @@ from distutils import sysconfig
import unittest import unittest
from test import support from test import support
# http://bugs.python.org/issue4373
# Don't load the xx module more than once.
ALREADY_TESTED = False
class BuildExtTestCase(unittest.TestCase): class BuildExtTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
# Create a simple test environment # Create a simple test environment
...@@ -23,6 +27,7 @@ class BuildExtTestCase(unittest.TestCase): ...@@ -23,6 +27,7 @@ class BuildExtTestCase(unittest.TestCase):
shutil.copy(xx_c, self.tmp_dir) shutil.copy(xx_c, self.tmp_dir)
def test_build_ext(self): def test_build_ext(self):
global ALREADY_TESTED
xx_c = os.path.join(self.tmp_dir, 'xxmodule.c') xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
xx_ext = Extension('xx', [xx_c]) xx_ext = Extension('xx', [xx_c])
dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]}) dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
...@@ -45,6 +50,11 @@ class BuildExtTestCase(unittest.TestCase): ...@@ -45,6 +50,11 @@ class BuildExtTestCase(unittest.TestCase):
finally: finally:
sys.stdout = old_stdout sys.stdout = old_stdout
if ALREADY_TESTED:
return
else:
ALREADY_TESTED = True
import xx import xx
for attr in ('error', 'foo', 'new', 'roj'): for attr in ('error', 'foo', 'new', 'roj'):
......
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