[Python-checkins] cpython: Issue 12132 - skip the test_buil_ext test if the xx module is not found

tarek.ziade python-checkins at python.org
Sun May 22 22:10:29 CEST 2011


http://hg.python.org/cpython/rev/1ba12ac770e0
changeset:   70277:1ba12ac770e0
user:        Tarek Ziade <tarek at ziade.org>
date:        Sun May 22 22:09:55 2011 +0200
summary:
  Issue 12132 - skip the test_buil_ext test if the xx module is not found

files:
  Lib/distutils/tests/test_build_ext.py         |  6 +++++-
  Lib/packaging/tests/test_command_build_ext.py |  6 +++++-
  Misc/NEWS                                     |  2 ++
  3 files changed, 12 insertions(+), 2 deletions(-)


diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py
--- a/Lib/distutils/tests/test_build_ext.py
+++ b/Lib/distutils/tests/test_build_ext.py
@@ -35,7 +35,9 @@
         self.tmp_dir = self.mkdtemp()
         self.sys_path = sys.path, sys.path[:]
         sys.path.append(self.tmp_dir)
-        shutil.copy(_get_source_filename(), self.tmp_dir)
+        filename = _get_source_filename()
+        if os.path.exists(filename):
+            shutil.copy(filename, self.tmp_dir)
         if sys.version > "2.6":
             import site
             self.old_user_base = site.USER_BASE
@@ -65,6 +67,8 @@
     def test_build_ext(self):
         global ALREADY_TESTED
         xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
+        if not os.path.exists(xx_c):
+            return
         xx_ext = Extension('xx', [xx_c])
         dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
         dist.package_dir = self.tmp_dir
diff --git a/Lib/packaging/tests/test_command_build_ext.py b/Lib/packaging/tests/test_command_build_ext.py
--- a/Lib/packaging/tests/test_command_build_ext.py
+++ b/Lib/packaging/tests/test_command_build_ext.py
@@ -32,7 +32,8 @@
         self.sys_path = sys.path, sys.path[:]
         sys.path.append(self.tmp_dir)
         filename = _get_source_filename()
-        shutil.copy(filename, self.tmp_dir)
+        if os.path.exists(filename):
+            shutil.copy(filename, self.tmp_dir)
         self.old_user_base = site.USER_BASE
         site.USER_BASE = self.mkdtemp()
         build_ext.USER_BASE = site.USER_BASE
@@ -59,6 +60,9 @@
     def test_build_ext(self):
         global ALREADY_TESTED
         xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
+        if not os.path.exists(xx_c):
+            # skipping if we cannot find it
+            return
         xx_ext = Extension('xx', [xx_c])
         dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
         dist.package_dir = self.tmp_dir
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -153,6 +153,8 @@
 Library
 -------
 
+- Issue #12132: Skip test_build_ext in case the xxmodule is not found.
+
 - Issue #12105: Add O_CLOEXEC to the os module.
 
 - Issue #12079: Decimal('Infinity').fma(Decimal('0'), (3.91224318126786e+19+0j))

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list