mirror of
https://github.com/python/cpython.git
synced 2025-10-03 13:45:29 +00:00
Merged revisions 69585 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r69585 | tarek.ziade | 2009-02-13 17:13:16 +0100 (Fri, 13 Feb 2009) | 1 line reverted leak fix, to use the one done in py3k branch (r67382) ........
This commit is contained in:
parent
21306ad174
commit
0e9bc48d8a
1 changed files with 12 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
|
@ -10,12 +11,15 @@ from distutils import sysconfig
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import test_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
|
||||||
# Note that we're making changes to sys.path
|
# Note that we're making changes to sys.path
|
||||||
self.tmp_dir = os.path.join(os.path.dirname(__file__), 'xx')
|
self.tmp_dir = tempfile.mkdtemp(prefix="pythontest_")
|
||||||
os.mkdir(self.tmp_dir)
|
|
||||||
self.sys_path = sys.path[:]
|
self.sys_path = sys.path[:]
|
||||||
sys.path.append(self.tmp_dir)
|
sys.path.append(self.tmp_dir)
|
||||||
|
|
||||||
|
@ -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):
|
||||||
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'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue