Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingface0 committed Jun 5, 2024
1 parent 2fa425b commit 778c297
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,22 @@ def cfg():

@pytest.fixture
def testing_database():
username = os.environ.get("POSTGRES_USERNAME", "postgres")
password = os.environ.get("POSTGRES_PASSWORD", "postgres")
host = os.environ.get("POSTGRES_HOST", "127.0.0.1")
port = os.environ.get("POSTGRES_PORT", 5432)
db_name = "postgres_test"
db_uri = DQM2MirrorDB.format_db_uri(
username=os.environ.get("POSTGRES_USERNAME", "postgres"),
password=os.environ.get("POSTGRES_PASSWORD", "postgres"),
host=os.environ.get("POSTGRES_HOST", "127.0.0.1"),
port=os.environ.get("POSTGRES_PORT", 5432),
db_name="postgres_test",
username=username, password=password, host=host, port=port, db_name=db_name
)
engine = create_engine(db_uri)
if not database_exists(engine.url):
create_database(db_uri)
db = DQM2MirrorDB(
log=dummy_log(),
username=os.environ.get("POSTGRES_USERNAME", "postgres"),
password=os.environ.get("POSTGRES_PASSWORD", "postgres"),
host=os.environ.get("POSTGRES_HOST", "127.0.0.1"),
port=os.environ.get("POSTGRES_PORT", 5432),
db_name="postgres_test",
server=False,

db = get_or_create_db(
db_uri=db_uri,
username=username,
password=password,
host=host,
port=port,
db_name=db_name,
)

fill_db(db)
Expand All @@ -123,8 +121,8 @@ def testing_databases():
password = os.environ.get("POSTGRES_PASSWORD", "postgres")
host = os.environ.get("POSTGRES_HOST", "127.0.0.1")
port = os.environ.get("POSTGRES_PORT", 5432)
db_prod_name = os.environ.get("POSTGRES_PRODUCTION_DB_NAME") + "_test"
db_play_name = os.environ.get("POSTGRES_PLAYBACK_DB_NAME") + "_test"
db_prod_name = "postgres_production_test"
db_play_name = "postgres_playback_tests"
db_prod_uri = DQM2MirrorDB.format_db_uri(
username=username, password=password, host=host, port=port, db_name=db_prod_name
)
Expand Down

0 comments on commit 778c297

Please sign in to comment.