summaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-08-30 11:16:14 +0200
committerArmin Rigo <arigo@tunes.org>2020-08-30 11:16:14 +0200
commitc8f247e223efc561173100bfc27fa059b950f626 (patch)
tree4bc02a0cfb0821eb7b59d01bce87bb0ce4391652 /c
parent586159ad522758943ee5c794e583c214fab6084e (diff)
downloadcffi-c8f247e223efc561173100bfc27fa059b950f626.tar.gz
let the test run directly on pypy too
Diffstat (limited to 'c')
-rw-r--r--c/test_c.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/c/test_c.py b/c/test_c.py
index 9348afd..e76950f 100644
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -3,17 +3,15 @@ import pytest
def _setup_path():
import os, sys
- if '__pypy__' in sys.builtin_module_names:
- global pytestmark
- pytestmark = pytest.mark.skip(
- "_cffi_backend.c: not tested on top of pypy, "
- "use pypy/module/_cffi_backend/test/ instead.")
- return False
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
- return True
-if _setup_path():
- from _cffi_backend import _testfunc, _get_types, _get_common_types
+_setup_path()
from _cffi_backend import *
+from _cffi_backend import _get_types, _get_common_types
+try:
+ from _cffi_backend import _testfunc
+except ImportError:
+ def _testfunc(num):
+ pytest.skip("_testunc() not available")
from _cffi_backend import __version__
# ____________________________________________________________
@@ -70,8 +68,10 @@ def find_and_load_library(name, flags=RTLD_NOW):
path = ctypes.util.find_library(name)
if path is None and name == 'c':
assert sys.platform == 'win32'
- assert sys.version_info >= (3,)
- py.test.skip("dlopen(None) cannot work on Windows with Python 3")
+ assert (sys.version_info >= (3,) or
+ '__pypy__' in sys.builtin_module_names)
+ py.test.skip("dlopen(None) cannot work on Windows "
+ "with PyPy or Python 3")
return load_library(path, flags)
def test_load_library():