Skip to content

Commit e729c2f

Browse files
author
vshepard
committed
Fix sys.modules instead globals
1 parent f1d28b4 commit e729c2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

testgres/operations/os_ops.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ def get_process_children(self, pid):
126126

127127
# Database control
128128
def db_connect(self, dbname, user, password=None, host="localhost", port=5432):
129-
ssl_options = {"sslmode": "disable"} if self.conn_params.skip_ssl and 'psycopg2' in globals() else {}
129+
ssl_options = {"sslmode": "disable"} if self.conn_params.skip_ssl and 'psycopg2' in sys.modules else {}
130130
conn = pglib.connect(
131131
host=host,
132132
port=port,
133133
database=dbname,
134134
user=user,
135135
password=password,
136-
**({"ssl_context": None} if self.conn_params.skip_ssl and 'pg8000' in globals() else ssl_options)
136+
**({"ssl_context": None} if self.conn_params.skip_ssl and 'pg8000' in sys.modules else ssl_options)
137137
)
138138

139139
return conn

0 commit comments

Comments
 (0)