Skip to content

Commit

Permalink
Pass through the database config correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
danpalmer committed May 6, 2018
1 parent dbb99ef commit 2f9d992
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion routemaster/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Global test setup and fixtures."""

import io
import os
import re
import json
Expand Down Expand Up @@ -535,6 +534,15 @@ def routemaster_serve_subprocess(unused_tcp_port):

@contextlib.contextmanager
def _inner():
env = os.environ.copy()
env.update({
'DB_HOST': os.environ.get('PG_HOST', 'localhost'),
'DB_PORT': os.environ.get('PG_PORT', '5432'),
'DB_NAME': os.environ.get('PG_DB', 'routemaster_test'),
'DB_USER': os.environ.get('PG_USER', ''),
'DB_PASS': os.environ.get('PG_PASS', ''),
})

try:
proc = subprocess.Popen(
[
Expand All @@ -544,6 +552,7 @@ def _inner():
'--bind',
f'127.0.0.1:{unused_tcp_port}',
],
env=env,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down

0 comments on commit 2f9d992

Please sign in to comment.