Skip to content

Commit

Permalink
Improve read-only connection string for Postgres (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaselIT authored Feb 18, 2020
1 parent e4d7865 commit b75af08
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ def drop_all(self):
if postgres_uri:
back_end = 'postgresql'
write_engine = create_engine(postgres_uri, echo=True)
# NOTE(vytas) We should parse the DB URI properly, but this simple
# heuristic should do for now.
ro_query = '&' if '?' in postgres_uri else '?'
ro_query += 'options=-c%20default_transaction_read_only%3Don'
read_engine = create_engine(postgres_uri + ro_query, echo=True)
args = {'options': '-c default_transaction_read_only=on'}
read_engine = create_engine(
postgres_uri, echo=True, connect_args=args)
else:
sqlite_path = os.environ.get(
'FALCON_SQLA_TEST_DB', '/tmp/falcon-sqla/test.db')
Expand Down

0 comments on commit b75af08

Please sign in to comment.