Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Refactor how TEST_SUITE is configured.
Tim Abbott2d1b21744123
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.pyindex e852bdf23b9..96fac4d7b94 100644--- a/zproject/computed_settings.py+++ b/zproject/computed_settings.py@@ -100,8 +100,6 @@ else:IS_WORKER = False-# This is overridden in test_settings.py for the test suites-TEST_SUITE = False# This is overridden in test_settings.py for the test suitesPUPPETEER_TESTS = False# This is overridden in test_settings.py for the test suitesdiff --git a/zproject/configured_settings.py b/zproject/configured_settings.pyindex 8e920cfcfe5..66037087a85 100644--- a/zproject/configured_settings.py+++ b/zproject/configured_settings.py@@ -2,6 +2,8 @@# DEFAULT VALUES FOR SETTINGS########################################################################+import os+# For any settings that are not set in the site-specific configuration file# (/etc/zulip/settings.py in production, or dev_settings.py or test_settings.py# in dev and test), we want to initialize them to sane defaults.@@ -11,6 +13,8 @@ from .default_settings import * # noqa: F403 isort: skip# Import prod_settings after determining the deployment/machine typefrom .config import PRODUCTION+TEST_SUITE = os.getenv("ZULIP_TEST_SUITE") == "true"+if PRODUCTION: # nocoveragefrom .prod_settings import * # noqa: F403 isort: skipelse:diff --git a/zproject/dev_settings.py b/zproject/dev_settings.pyindex 9e31b9b2eb2..05f335a747c 100644--- a/zproject/dev_settings.py+++ b/zproject/dev_settings.py@@ -7,6 +7,9 @@ from zproject.settings_types import SCIMConfigDictZULIP_ADMINISTRATOR = "[email protected]"+# Initiatize TEST_SUITE early, so other code can rely on the setting.+TEST_SUITE = os.getenv("ZULIP_TEST_SUITE") == "true"+# We want LOCAL_UPLOADS_DIR to be an absolute path so that code can# chdir without having problems accessing it. Unfortunately, this# means we need a duplicate definition of DEPLOY_ROOT with the one indiff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.pyindex 0b4924d8209..1028ce58f9e 100644--- a/zproject/test_extra_settings.py+++ b/zproject/test_extra_settings.py@@ -82,7 +82,6 @@ AUTH_LDAP_REVERSE_EMAIL_SEARCH = LDAPSearch("ou=users,dc=zulip,dc=com", ldap.SCOPE_ONELEVEL, "(mail=%(email)s)")-TEST_SUITE = TrueRATE_LIMITING = FalseRATE_LIMITING_AUTHENTICATE = False# Don't use RabbitMQ from the test suite -- the user_profile_ids fordiff --git a/zproject/test_settings.py b/zproject/test_settings.pyindex f8751e33304..228cbfee6cb 100644--- a/zproject/test_settings.py+++ b/zproject/test_settings.py@@ -16,6 +16,7 @@ import os# it can be set there, at the right place in the settings.py flow.# Ick.os.environ["EXTERNAL_HOST"] = os.getenv("TEST_EXTERNAL_HOST", "testserver")+os.environ["ZULIP_TEST_SUITE"] = "true"from .settings import * # noqa: F403 isort: skipfrom .test_extra_settings import * # noqa: F403 isort: skip