Skip to content
Snippets Groups Projects
Commit 2fa4453c authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[settings][test] Use new helper method to setup prefix and db

parent b8fe5eec
No related branches found
No related tags found
1 merge request!330Fix parallel testing on ci
......@@ -27,9 +27,10 @@
# Django settings for tests
import os
import platform
from .settings import * # noqa
from . import get_test_db_path
from . import get_test_prefix_path
URL_PREFIX = ""
......@@ -41,17 +42,7 @@ TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG # noqa
ALLOWED_HOSTS = ["testserver"]
if platform.system() == "Linux":
shm_path = "/dev/shm/beatweb" # nosec
if not os.path.exists(shm_path):
os.makedirs(shm_path)
database_name = os.path.join(shm_path, "test.sqlite3")
else:
here = os.path.dirname(os.path.realpath(__file__))
database_name = os.path.join(here, "test.sqlite3")
DATABASES["default"]["NAME"] = database_name # noqa
DATABASES["default"]["NAME"] = get_test_db_path(RUNNING_ON_CI) # noqa
DATABASES["default"]["TEST"] = {"NAME": DATABASES["default"]["NAME"]} # noqa
DATABASES["default"]["OPTIONS"]["timeout"] = 30 # noqa
DATABASES["default"]["ATOMIC_REQUESTS"] = True # noqa
......@@ -67,11 +58,7 @@ LOGGING["loggers"]["beat.web.utils.management.commands"]["handlers"] = [ # noqa
]
BASE_DIR = os.path.dirname(os.path.abspath(__name__))
if platform.system() == "Linux":
default_prefix = os.path.join(shm_path, "test_prefix") # nosec
else:
default_prefix = os.path.realpath("./test_prefix")
PREFIX = os.environ.get("BEAT_TEST_PREFIX", default_prefix)
PREFIX = os.environ.get("BEAT_TEST_PREFIX", get_test_prefix_path(RUNNING_ON_CI))
ALGORITHMS_ROOT = os.path.join(PREFIX, "algorithms")
PLOTTERS_ROOT = os.path.join(PREFIX, "plotters")
LIBRARIES_ROOT = os.path.join(PREFIX, "libraries")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment