]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue 12132 - skip the test_buil_ext test if the xx module is not found
authorTarek Ziade <tarek@ziade.org>
Sun, 22 May 2011 20:09:55 +0000 (22:09 +0200)
committerTarek Ziade <tarek@ziade.org>
Sun, 22 May 2011 20:09:55 +0000 (22:09 +0200)
Lib/distutils/tests/test_build_ext.py
Lib/packaging/tests/test_command_build_ext.py
Misc/NEWS

index 0aa99babee4c5fb97f07d743360de3b35e0774c3..a5b9700fe680362548f8083df603b5d85dbc97ef 100644 (file)
@@ -35,7 +35,9 @@ class BuildExtTestCase(TempdirManager,
         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 @@ class BuildExtTestCase(TempdirManager,
     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
index 680f5c07dde7d3ba8cc317afada82a4888b59e96..fba27c7213bfca0f68fe421ef0bb5eebc28f5d2e 100644 (file)
@@ -32,7 +32,8 @@ class BuildExtTestCase(support.TempdirManager,
         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 @@ class BuildExtTestCase(support.TempdirManager,
     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
index 963ff893daa3167fcf9664c345a190c69d51f050..6ebb33a8f99ca399732791d936d5300239ddcb63 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -153,6 +153,8 @@ Core and Builtins
 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))