Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r63706:0d7e97357d2b
Date: 2013-04-27 14:44 -0700
http://bitbucket.org/pypy/pypy/changeset/0d7e97357d2b/
Log: on CPython, fallback to importing usemodules incase they're
extension modules
diff --git a/pypy/tool/pytest/apptest.py b/pypy/tool/pytest/apptest.py
--- a/pypy/tool/pytest/apptest.py
+++ b/pypy/tool/pytest/apptest.py
@@ -131,8 +131,22 @@
usemodules = [str(RENAMED_USEMODULES.get(name, name))
for name in usemodules]
check_usemodules = """\
- if not set(%r).issubset(sys.builtin_module_names):
- sys.exit(81)""" % usemodules
+ missing = set(%r).difference(sys.builtin_module_names)
+ if missing:
+ if not hasattr(sys, 'pypy_version_info'):
+ # They may be extension modules on CPython
+ name = None
+ for name in missing.copy():
+ try:
+ __import__(name)
+ except ImportError:
+ pass
+ else:
+ missing.remove(name)
+ del name
+ if missing:
+ sys.exit(81)
+ del missing""" % usemodules
source = list(py.code.Source(target_))
while source[0].startswith(('@py.test.mark.', '@pytest.mark.')):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit