Commit faadacc9 authored by Hermann Krumrey's avatar Hermann Krumrey

Load env file at runtime while running tests

parent e5d18bea
Pipeline #1836 passed with stages
in 3 minutes and 49 seconds
......@@ -34,9 +34,8 @@ unittest:
only: [master, develop]
script:
- echo "$ENV_FILE" > .env
- export $(grep -v '^#' .env | xargs)
- rm .env
- python-unittest
- rm .env
type_check:
stage: test
......
......@@ -26,6 +26,7 @@ from fat_ffipd.run import app, db, init
from fat_ffipd.config import Config
from fat_ffipd.db.User import User
from fat_ffipd.db.ApiKey import ApiKey
from puffotter.env import load_env_file
class _TestFramework(TestCase):
......@@ -39,6 +40,7 @@ class _TestFramework(TestCase):
:return: None
"""
os.environ["FLASK_TESTING"] = "1"
load_env_file()
self.app = app
self.db = db
......
......@@ -55,7 +55,13 @@ def main():
copytree(".", temp_path)
copytree(temp_path, target_path)
rmtree(temp_path)
rmtree(os.path.join(target_path, ".git"))
for x in [".git", ".idea", "build", "dist", "fat_ffipd.egg-info"]:
path = os.path.join(target_path, x)
if os.path.isdir(path):
rmtree(path)
elif os.path.isfile(path):
os.remove(path)
copyright_notice = "Copyright {} {} <{}>".format(
args.copyright_year, args.author_name, args.author_email
......@@ -91,7 +97,7 @@ def main():
"MYSQL_USER=\n"
"MYSQL_PASSWORD=\n"
"MYSQL_DATABASE=\n"
"MYSQL_SECRET=\n"
"FLASK_SECRET=\n"
"RECAPTCHA_SECRET_KEY=\n"
"RECAPTCHA_SITE_KEY=\n"
"SMTP_ADDRESS=\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment