From 17cb9087535a251b470b29c95d2ce68010a16185 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Sun, 21 Jan 2024 22:40:31 +0000 Subject: [PATCH] Ensure env vars are set for test environment --- .gitlab-ci.yml | 3 +++ tests/__init__.py | 4 ++++ tests/database/__init__.py | 7 +------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0a2b3f..60e6086 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,6 @@ +variables: + ENVIRON: "test" + pytest: stage: test script: diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..d1bee94 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,4 @@ +import os + +# Setup test environment variables +os.environ["ENVIRON"] = "test" diff --git a/tests/database/__init__.py b/tests/database/__init__.py index 19487b8..9bd5abe 100644 --- a/tests/database/__init__.py +++ b/tests/database/__init__.py @@ -1,8 +1,3 @@ # Ensure test environment is set before using -import scripts.create_database -import os - -# Setup test environment variables -os.environ["ENVIRON"] = "test" - # Runs the database creation scripts +import scripts.create_database