summaryrefslogtreecommitdiff
path: root/ext/pybind11/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pybind11/tests/conftest.py')
-rw-r--r--ext/pybind11/tests/conftest.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/pybind11/tests/conftest.py b/ext/pybind11/tests/conftest.py
index d4335fc6d..5b08004e3 100644
--- a/ext/pybind11/tests/conftest.py
+++ b/ext/pybind11/tests/conftest.py
@@ -10,6 +10,8 @@ import difflib
import re
import sys
import contextlib
+import platform
+import gc
_unicode_marker = re.compile(r'u(\'[^\']*\')')
_long_marker = re.compile(r'([0-9])L')
@@ -101,9 +103,9 @@ class Capture(object):
@pytest.fixture
-def capture(capfd):
- """Extended `capfd` with context manager and custom equality operators"""
- return Capture(capfd)
+def capture(capsys):
+ """Extended `capsys` with context manager and custom equality operators"""
+ return Capture(capsys)
class SanitizedString(object):
@@ -176,6 +178,13 @@ def suppress(exception):
pass
+def gc_collect():
+ ''' Run the garbage collector twice (needed when running
+ reference counting tests with PyPy) '''
+ gc.collect()
+ gc.collect()
+
+
def pytest_namespace():
"""Add import suppression and test requirements to `pytest` namespace"""
try:
@@ -190,6 +199,7 @@ def pytest_namespace():
from pybind11_tests import have_eigen
except ImportError:
have_eigen = False
+ pypy = platform.python_implementation() == "PyPy"
skipif = pytest.mark.skipif
return {
@@ -200,6 +210,8 @@ def pytest_namespace():
reason="eigen and/or numpy are not installed"),
'requires_eigen_and_scipy': skipif(not have_eigen or not scipy,
reason="eigen and/or scipy are not installed"),
+ 'unsupported_on_pypy': skipif(pypy, reason="unsupported on PyPy"),
+ 'gc_collect': gc_collect
}