summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTarek Ziade <tarek@ziade.org>2011-05-22 20:09:55 (GMT)
committerTarek Ziade <tarek@ziade.org>2011-05-22 20:09:55 (GMT)
commit3517369894fa03ebd42e2ee50643dc072eea770f (patch)
treef66006534b9e54a864998d42853f5fd9ade2a7a8 /Lib
parent2bc55e482e25587822816c3ccfc30bf66fd3f1a3 (diff)
downloadcpython-3517369894fa03ebd42e2ee50643dc072eea770f.zip
cpython-3517369894fa03ebd42e2ee50643dc072eea770f.tar.gz
cpython-3517369894fa03ebd42e2ee50643dc072eea770f.tar.bz2
Issue 12132 - skip the test_buil_ext test if the xx module is not found
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/tests/test_build_ext.py6
-rw-r--r--Lib/packaging/tests/test_command_build_ext.py6
2 files changed, 10 insertions, 2 deletions
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py
index 0aa99ba..a5b9700 100644
--- a/Lib/distutils/tests/test_build_ext.py
+++ b/Lib/distutils/tests/test_build_ext.py
@@ -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
diff --git a/Lib/packaging/tests/test_command_build_ext.py b/Lib/packaging/tests/test_command_build_ext.py
index 680f5c0..fba27c7 100644
--- a/Lib/packaging/tests/test_command_build_ext.py
+++ b/Lib/packaging/tests/test_command_build_ext.py
@@ -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