[pypy-commit] pypy default: Remove py.test.importorskip(): it might skip (not fail) also if it fails
arigo
pypy.commits at gmail.com
Fri Nov 18 09:17:53 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r88465:18e3e31a4c63
Date: 2016-11-18 15:17 +0100
http://bitbucket.org/pypy/pypy/changeset/18e3e31a4c63/
Log: Remove py.test.importorskip(): it might skip (not fail) also if it
fails to import pkg_resources to check the version we provide. IMHO
that's not good at all. So don't trust it and write try: ... except
ImportError: explicitly. The version number checking can be written
explicitly too, but in this case it can be removed (it was for older
Python < 2.7).
diff --git a/pypy/module/select/conftest.py b/pypy/module/select/conftest.py
deleted file mode 100644
--- a/pypy/module/select/conftest.py
+++ /dev/null
@@ -1,4 +0,0 @@
-import py
-
-def pytest_collect_directory():
- py.test.importorskip("ctypes")
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/support.py b/pypy/module/test_lib_pypy/ctypes_tests/support.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/support.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/support.py
@@ -2,8 +2,6 @@
import sys
import ctypes
-py.test.importorskip("ctypes", "1.0.2")
-
try:
import _rawffi
except ImportError:
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_errno.py b/pypy/module/test_lib_pypy/ctypes_tests/test_errno.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_errno.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_errno.py
@@ -3,7 +3,10 @@
import ctypes
from _ctypes import function
-_rawffi = py.test.importorskip("_rawffi")
+try:
+ import _rawffi
+except ImportError:
+ py.test.skip("app-level test only for PyPy")
class TestErrno:
diff --git a/pypy/module/test_lib_pypy/pyrepl/test_functional.py b/pypy/module/test_lib_pypy/pyrepl/test_functional.py
--- a/pypy/module/test_lib_pypy/pyrepl/test_functional.py
+++ b/pypy/module/test_lib_pypy/pyrepl/test_functional.py
@@ -9,7 +9,9 @@
def pytest_funcarg__child(request):
try:
- pexpect = pytest.importorskip('pexpect')
+ import pexpect
+ except ImportError:
+ pytest.skip("no pexpect module")
except SyntaxError:
pytest.skip('pexpect wont work on py3k')
child = pexpect.spawn(sys.executable, ['-S'], timeout=10)
More information about the pypy-commit
mailing list