[pypy-commit] pypy pytest: kill tool/pytest/modcheck for pytest.importorskip

RonnyPfannschmidt noreply at buildbot.pypy.org
Mon Apr 23 11:00:30 CEST 2012


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: pytest
Changeset: r54655:3bcc57452f5c
Date: 2012-04-23 10:59 +0200
http://bitbucket.org/pypy/pypy/changeset/3bcc57452f5c/

Log:	kill tool/pytest/modcheck for pytest.importorskip

diff --git a/pypy/rpython/module/test/test_ll_os_path.py b/pypy/rpython/module/test/test_ll_os_path.py
--- a/pypy/rpython/module/test/test_ll_os_path.py
+++ b/pypy/rpython/module/test/test_ll_os_path.py
@@ -2,14 +2,15 @@
 
 import sys, os
 
-from pypy.tool.pytest.modcheck import skipimporterror
-skipimporterror("ctypes")
-
 from pypy.rpython.lltypesystem.module.ll_os_path import Implementation as impl
 from pypy.rpython.module.support import ll_strcpy
 from pypy.rpython.test.test_llinterp import interpret
 from pypy.tool.udir import udir
 
+
+def setup_module(mod):
+    py.test.importorskip('ctypes')
+
 def test_exists():
     filename = impl.to_rstr(str(py.path.local(__file__)))
     assert impl.ll_os_path_exists(filename) == True
diff --git a/pypy/tool/pytest/modcheck.py b/pypy/tool/pytest/modcheck.py
deleted file mode 100644
--- a/pypy/tool/pytest/modcheck.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import py
-
-def skipimporterror(name):
-    if not hasimport(name):
-        __tracebackhide__ = True
-        py.test.skip("cannot import %r module" % (name,))
-
-def hasimport(name):
-    try:
-        __import__(name)
-    except ImportError:
-        return False
-    else:
-        return True


More information about the pypy-commit mailing list