Skip to content

Commit 817a249

Browse files
committed
test: fix ImportError if psycopg2 not installed
test_postgresql was reaching into roundup.backends.back_postgresql before checking to see if psycopg2 was available. Move the (partly duplicated) import inside the guard so it imports only if psycopg2 is available.
1 parent d49b2a0 commit 817a249

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/test_postgresql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
from roundup.hyperdb import DatabaseError
2323
from roundup.backends import get_backend, have_backend
24-
from roundup.backends.back_postgresql import db_command, get_database_schema_names
2524

2625
from .db_test_base import DBTest, ROTest, config, SchemaTest, ClassicInitTest
2726
from .db_test_base import ConcurrentDBTest, HTMLItemTest, FilterCacheTest
@@ -36,7 +35,8 @@
3635
reason='Skipping PostgreSQL tests: backend not available'))
3736
else:
3837
try:
39-
from roundup.backends.back_postgresql import psycopg2, db_command
38+
from roundup.backends.back_postgresql import psycopg2, db_command,\
39+
get_database_schema_names
4040
db_command(config, 'select 1')
4141
skip_postgresql = lambda func, *args, **kwargs: func
4242
except( DatabaseError ) as msg:

0 commit comments

Comments
 (0)