From f897bb01a361011f38530d73bd24fa09c962e321 Mon Sep 17 00:00:00 2001 From: Finn Stutzenstein Date: Mon, 22 Mar 2021 13:01:20 +0100 Subject: [PATCH] Enable pytest in docker The DJANGO_SETTINGS_MODULE is set in the develop container, so the tests.settings from the setup.cfg was ignored. Executing pytest with DJANGO_SETTINGS_MODULE=tests.settings pytest works fine. The line added in the setup.cfg takes over precedence: It auto-adds the --ds parameter which has a higher precedence than the environment variable. Also removed an unnecessary setting. --- server/setup.cfg | 1 + server/tests/settings.py | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/server/setup.cfg b/server/setup.cfg index 748246942..f7d3e08e8 100644 --- a/server/setup.cfg +++ b/server/setup.cfg @@ -34,6 +34,7 @@ disallow_untyped_defs = true [tool:pytest] DJANGO_SETTINGS_MODULE = tests.settings +addopts = --ds=tests.settings testpaths = tests/ filterwarnings = ignore:RemovedInDjango30Warning diff --git a/server/tests/settings.py b/server/tests/settings.py index 912e7eb96..a4d36f606 100644 --- a/server/tests/settings.py +++ b/server/tests/settings.py @@ -70,9 +70,6 @@ MEDIA_ROOT = os.path.join(OPENSLIDES_USER_DATA_PATH, "") PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] -# Deactivate restricted_data_cache -RESTRICTED_DATA_CACHE = False - REST_FRAMEWORK = {"TEST_REQUEST_DEFAULT_FORMAT": "json"} ENABLE_ELECTRONIC_VOTING = True