From c8bf2c20714538f107b0e8a2a0ced5a1d3c91451 Mon Sep 17 00:00:00 2001 From: boyska Date: Wed, 29 Sep 2021 00:31:08 +0200 Subject: [PATCH] disable some checks if testing --- techrec/cli.py | 7 +++++-- techrec/server.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/techrec/cli.py b/techrec/cli.py index 49dc81d..bb231c1 100644 --- a/techrec/cli.py +++ b/techrec/cli.py @@ -78,8 +78,11 @@ class DateTimeAction(Action): code_dir = os.path.dirname(os.path.realpath(__file__)) -def common_pre(): - prechecks = [pre_check_user, pre_check_permissions, pre_check_ffmpeg] +def common_pre(nochecks=False): + if nochecks: + prechecks = [] + else: + prechecks = [pre_check_user, pre_check_permissions, pre_check_ffmpeg] configs = ["default_config.py"] if "TECHREC_CONFIG" in os.environ: for conf in os.environ["TECHREC_CONFIG"].split(":"): diff --git a/techrec/server.py b/techrec/server.py index f0b14ab..7218b8c 100644 --- a/techrec/server.py +++ b/techrec/server.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import sys import logging import time import os @@ -20,7 +21,7 @@ from .forge import create_mp3, Validator logger = logging.getLogger("server") -common_pre() +common_pre(nochecks=('pytest' in sys.argv[0])) app = FastAPI() db = None