mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-08-04 12:20:09 +03:00
skip_if_no_getrefcount restored
This commit is contained in:
parent
e850d20271
commit
693a6cd75c
|
@ -27,7 +27,8 @@ import pickle
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import psycopg2.extensions
|
import psycopg2.extensions
|
||||||
from testutils import (unittest, ConnectingTestCase, skip_before_postgres,
|
from testutils import (unittest, ConnectingTestCase, skip_before_postgres,
|
||||||
slow, skip_if_no_superuser, skip_if_windows)
|
skip_if_no_getrefcount, slow, skip_if_no_superuser,
|
||||||
|
skip_if_windows)
|
||||||
|
|
||||||
import psycopg2.extras
|
import psycopg2.extras
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@ class CursorTests(ConnectingTestCase):
|
||||||
self.assertEqual(b'SELECT 10.3;',
|
self.assertEqual(b'SELECT 10.3;',
|
||||||
cur.mogrify("SELECT %s;", (Decimal("10.3"),)))
|
cur.mogrify("SELECT %s;", (Decimal("10.3"),)))
|
||||||
|
|
||||||
|
@skip_if_no_getrefcount
|
||||||
def test_mogrify_leak_on_multiple_reference(self):
|
def test_mogrify_leak_on_multiple_reference(self):
|
||||||
# issue #81: reference leak when a parameter value is referenced
|
# issue #81: reference leak when a parameter value is referenced
|
||||||
# more than once from a dict.
|
# more than once from a dict.
|
||||||
|
|
|
@ -350,6 +350,16 @@ def skip_if_green(reason):
|
||||||
skip_copy_if_green = skip_if_green("copy in async mode currently not supported")
|
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 skip_if_windows(f):
|
def skip_if_windows(f):
|
||||||
"""Skip a test if run on windows"""
|
"""Skip a test if run on windows"""
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user