Changeset 698


Ignore:
Timestamp:
Jan 7, 2016, 5:00:27 PM (4 years ago)
Author:
cito
Message:

Skip over known libpq issue under Windows

Location:
branches/4.x/module/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.x/module/tests/test_classic_connection.py

    r690 r698  
    2020import threading
    2121import time
     22import os
    2223
    2324import pg  # the module under test
     
    4041    pass
    4142
     43windows = os.name == 'nt'
     44
     45# There is a known a bug in libpq under Windows which can cause
     46# the interface to crash when calling PQhost():
     47do_not_ask_for_host = windows
     48do_not_ask_for_host_reason = 'libpq issue on Windows'
     49
    4250
    4351def connect():
     
    7482            pass
    7583
     84    def is_method(self, attribute):
     85        """Check if given attribute on the connection is a method."""
     86        if do_not_ask_for_host and attribute == 'host':
     87            return False
     88        return callable(getattr(self.connection, attribute))
     89
    7690    def testAllConnectAttributes(self):
    7791        attributes = '''db error host options port
    7892            protocol_version server_version status tty user'''.split()
    7993        connection_attributes = [a for a in dir(self.connection)
    80             if not callable(eval("self.connection." + a))]
     94            if not a.startswith('__') and not self.is_method(a)]
    8195        self.assertEqual(attributes, connection_attributes)
    8296
     
    91105            methods.remove('escape_literal')
    92106        connection_methods = [a for a in dir(self.connection)
    93             if callable(eval("self.connection." + a))]
     107            if not a.startswith('__') and self.is_method(a)]
    94108        self.assertEqual(methods, connection_methods)
    95109
     
    101115        self.assertTrue(not error or 'krb5_' in error)
    102116
     117    @unittest.skipIf(do_not_ask_for_host, do_not_ask_for_host_reason)
    103118    def testAttributeHost(self):
    104119        def_host = 'localhost'
  • branches/4.x/module/tests/test_classic_dbwrapper.py

    r690 r698  
    1616except ImportError:
    1717    import unittest
     18import os
    1819
    1920import sys
     
    3940except ImportError:
    4041    pass
     42
     43windows = os.name == 'nt'
     44
     45# There is a known a bug in libpq under Windows which can cause
     46# the interface to crash when calling PQhost():
     47do_not_ask_for_host = windows
     48do_not_ask_for_host_reason = 'libpq issue on Windows'
    4149
    4250
     
    139147        self.assertEqual(self.db.error, self.db.db.error)
    140148
     149    @unittest.skipIf(do_not_ask_for_host, do_not_ask_for_host_reason)
    141150    def testAttributeHost(self):
    142151        def_host = 'localhost'
Note: See TracChangeset for help on using the changeset viewer.