diff options
author | Collin Winter <collinw@gmail.com> | 2010-02-03 22:06:03 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2010-02-03 22:06:03 (GMT) |
commit | 54c45787e43761f5fefecef613859d81eb8bedd3 (patch) | |
tree | 8dfdb5119aa0ee068d31377e9f82b699ff308301 /Lib/distutils | |
parent | 2905baff05c4d1a96b5cb92398af512f7bb6ddee (diff) | |
download | cpython-54c45787e43761f5fefecef613859d81eb8bedd3.zip cpython-54c45787e43761f5fefecef613859d81eb8bedd3.tar.gz cpython-54c45787e43761f5fefecef613859d81eb8bedd3.tar.bz2 |
Merged revisions 69304 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69304 | neil.schemenauer | 2009-02-05 08:25:16 -0800 (Thu, 05 Feb 2009) | 4 lines
Fix test_build_ext.py to work when building in a separate directory.
Since "srcdir" should now be defined on all platforms, use it to
find the module source.
........
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/tests/test_build_ext.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 93d1881..a1c236a 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -13,11 +13,14 @@ from distutils.errors import DistutilsSetupError 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') + class BuildExtTestCase(support.TempdirManager, support.LoggingSilencer, unittest.TestCase): @@ -28,9 +31,7 @@ class BuildExtTestCase(support.TempdirManager, self.tmp_dir = tempfile.mkdtemp(prefix="pythontest_") self.sys_path = sys.path[:] sys.path.append(self.tmp_dir) - - xx_c = os.path.join(sysconfig.project_base, 'Modules', 'xxmodule.c') - shutil.copy(xx_c, self.tmp_dir) + shutil.copy(_get_source_filename(), self.tmp_dir) def test_build_ext(self): global ALREADY_TESTED @@ -387,9 +388,11 @@ class BuildExtTestCase(support.TempdirManager, self.assertEquals(ext_path, wanted) def test_suite(): - if not sysconfig.python_build: + src = _get_source_filename() + if not os.path.exists(src): if test_support.verbose: - print 'test_build_ext: The test must be run in a python build dir' + print ('test_build_ext: Cannot find source code (test' + ' must run in python build dir)') return unittest.TestSuite() else: return unittest.makeSuite(BuildExtTestCase) |