[Python-checkins] r69585 - python/trunk/Lib/distutils/tests/test_build_ext.py
tarek.ziade
python-checkins at python.org
Fri Feb 13 17:13:17 CET 2009
Author: tarek.ziade
Date: Fri Feb 13 17:13:16 2009
New Revision: 69585
Log:
reverted leak fix, to use the one done in py3k branch (r67382)
Modified:
python/trunk/Lib/distutils/tests/test_build_ext.py
Modified: python/trunk/Lib/distutils/tests/test_build_ext.py
==============================================================================
--- python/trunk/Lib/distutils/tests/test_build_ext.py (original)
+++ python/trunk/Lib/distutils/tests/test_build_ext.py Fri Feb 13 17:13:16 2009
@@ -1,5 +1,6 @@
import sys
import os
+import tempfile
import shutil
from StringIO import StringIO
@@ -10,6 +11,10 @@
import unittest
from test import test_support
+# http://bugs.python.org/issue4373
+# Don't load the xx module more than once.
+ALREADY_TESTED = False
+
def _get_source_filename():
srcdir = sysconfig.get_config_var('srcdir')
return os.path.join(srcdir, 'Modules', 'xxmodule.c')
@@ -18,13 +23,13 @@
def setUp(self):
# Create a simple test environment
# Note that we're making changes to sys.path
- self.tmp_dir = os.path.join(os.path.dirname(__file__), 'xx')
- os.mkdir(self.tmp_dir)
+ self.tmp_dir = tempfile.mkdtemp(prefix="pythontest_")
self.sys_path = sys.path[:]
sys.path.append(self.tmp_dir)
shutil.copy(_get_source_filename(), self.tmp_dir)
def test_build_ext(self):
+ global ALREADY_TESTED
xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
xx_ext = Extension('xx', [xx_c])
dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
@@ -47,6 +52,11 @@
finally:
sys.stdout = old_stdout
+ if ALREADY_TESTED:
+ return
+ else:
+ ALREADY_TESTED = True
+
import xx
for attr in ('error', 'foo', 'new', 'roj'):
More information about the Python-checkins
mailing list