summaryrefslogtreecommitdiff
path: root/tests/testutils.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-05-06 10:39:24 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-05-06 10:39:24 +0100
commita44db81d9bde28ac9883d6f4b676aef2e56ed999 (patch)
tree5b35a9234b6e877edcabad41802b26d6778b34dc /tests/testutils.py
parentbbe0bf955cb78f2135c790056b191492919e892f (diff)
downloadpsycopg2-a44db81d9bde28ac9883d6f4b676aef2e56ed999.tar.gz
Skip tests on python implementations without getrefcount()
PyPy is one of these.
Diffstat (limited to 'tests/testutils.py')
-rw-r--r--tests/testutils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/testutils.py b/tests/testutils.py
index 1e2e150..708dd22 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -293,6 +293,15 @@ def skip_if_green(reason):
skip_copy_if_green = skip_if_green("copy in async mode currently not supported")
+def skip_if_no_getrefcount(f):
+ @wraps(f)
+ def skip_if_no_getrefcount_(self):
+ if not hasattr(sys, 'getrefcount'):
+ return self.skipTest('skipped, no sys.getrefcount()')
+ else:
+ return f(self)
+ return skip_if_no_getrefcount_
+
def script_to_py3(script):
"""Convert a script to Python3 syntax if required."""
if sys.version_info[0] < 3: