diff --git a/tests/test_connection.py b/tests/test_connection.py index 21f7a499..65074048 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -34,6 +34,7 @@ import psycopg2.extensions from testutils import unittest, decorate_all_tests, skip_if_no_superuser from testutils import skip_before_postgres, skip_after_postgres from testutils import ConnectingTestCase, skip_if_tpc_disabled +from testutils import skip_if_windows from testconfig import dsn, dbname @@ -64,6 +65,7 @@ class ConnectionTests(ConnectingTestCase): @skip_before_postgres(8, 4) @skip_if_no_superuser + @skip_if_windows def test_cleanup_on_badconn_close(self): # ticket #148 conn = self.conn diff --git a/tests/testutils.py b/tests/testutils.py index 0569edef..12732ac6 100644 --- a/tests/testutils.py +++ b/tests/testutils.py @@ -25,6 +25,7 @@ # Use unittest2 if available. Otherwise mock a skip facility with warnings. import os +import platform import sys from functools import wraps from testconfig import dsn @@ -302,6 +303,17 @@ def skip_if_no_getrefcount(f): return f(self) return skip_if_no_getrefcount_ +def skip_if_windows(f): + """Skip a test if run on windows""" + @wraps(f) + def skip_if_windows_(self): + if platform.system() == 'Windows': + return self.skipTest("Not supported on Windows") + else: + return f(self) + return skip_if_windows_ + + def script_to_py3(script): """Convert a script to Python3 syntax if required.""" if sys.version_info[0] < 3: