Commit b8fe5eec authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[settings] Add helper methods to determine db and prefix path for tests

These will return the paths based on whether it's a CI run
or a standard run.
parent 498bb740
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.web module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
import os
import platform
SHM_PATH = "/dev/shm/beatweb" # nosec
def get_test_db_path(is_on_ci):
database_name = "test.sqlite3"
database_path = os.path.realpath("./")
if not is_on_ci:
if platform.system() == "Linux":
database_path = SHM_PATH
if not os.path.exists(database_path):
os.makedirs(database_path)
return os.path.join(database_path, database_name)
def get_test_prefix_path(is_on_ci):
prefix_path = os.path.realpath("./test_prefix")
if not is_on_ci:
if platform.system() == "Linux":
prefix_path = os.path.join(SHM_PATH, "test_prefix") # nosec
return prefix_path
Supports Markdown
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