mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-28 20:03:43 +03:00
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.
This commit is contained in:
parent
c5f2e29dde
commit
8746b0c6b7
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user