diff options
author | Jason Erickson <jerickso@stickpeople.com> | 2014-05-12 16:12:50 -0600 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-05-19 12:15:53 +0100 |
commit | 8746b0c6b7a243f97fa2d769c6cbf4b48a523ab3 (patch) | |
tree | 558f52ebffa3e4b3937a8a5d54004558aa1ed5f3 /tests/testutils.py | |
parent | c5f2e29dde8bc18f27f2f221ca684b07477cdeb4 (diff) | |
download | psycopg2-8746b0c6b7a243f97fa2d769c6cbf4b48a523ab3.tar.gz |
Skip test_cleanup_on_badconn_close on Windows
The Windows server version of PostgreSQL uses a function called pgkill in the
file kill.c in place of the UNIX kill function. This pgkill function
simulates some of the SIGHUP like commands by passing signals through a named
pipe. Because it is passing the signal through a pipe, the server doesn't get
the kill signal immediately and therefore fails the test on
test_connection.ConnectionTests.test_cleanup_on_badconn_close.
Ideally, the test should check to see if the server is running on Windows, not
the psycopg.
Diffstat (limited to 'tests/testutils.py')
-rw-r--r-- | tests/testutils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/testutils.py b/tests/testutils.py index 0569ede..12732ac 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: |