Skip to content

Commit 2269269

Browse files
committed
Moved Murfey DB URL out of fixture and into a module-level variable
1 parent 7fae5d8 commit 2269269

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/conftest.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,15 @@ def ispyb_db_session(
285285
=======================================================================================
286286
"""
287287

288+
murfey_db_url = (
289+
f"postgresql+psycopg2://{os.environ['POSTGRES_USER']}:{os.environ['POSTGRES_PASSWORD']}"
290+
f"@{os.environ['POSTGRES_HOST']}:{os.environ['POSTGRES_PORT']}/{os.environ['POSTGRES_DB']}"
291+
)
292+
288293

289294
@pytest.fixture(scope="session")
290295
def murfey_db_engine():
291-
url = (
292-
f"postgresql+psycopg2://{os.environ['POSTGRES_USER']}:{os.environ['POSTGRES_PASSWORD']}"
293-
f"@{os.environ['POSTGRES_HOST']}:{os.environ['POSTGRES_PORT']}/{os.environ['POSTGRES_DB']}"
294-
)
295-
engine = create_engine(url)
296+
engine = create_engine(murfey_db_url)
296297
SQLModel.metadata.create_all(engine)
297298
yield engine
298299
engine.dispose()

0 commit comments

Comments
 (0)