diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py index e852bdf23b..96fac4d7b9 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 suites PUPPETEER_TESTS = False # This is overridden in test_settings.py for the test suites diff --git a/zproject/configured_settings.py b/zproject/configured_settings.py index 8e920cfcfe..66037087a8 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 type from .config import PRODUCTION +TEST_SUITE = os.getenv("ZULIP_TEST_SUITE") == "true" + if PRODUCTION: # nocoverage from .prod_settings import * # noqa: F403 isort: skip else: diff --git a/zproject/dev_settings.py b/zproject/dev_settings.py index 9e31b9b2eb..05f335a747 100644 --- a/zproject/dev_settings.py +++ b/zproject/dev_settings.py @@ -7,6 +7,9 @@ from zproject.settings_types import SCIMConfigDict ZULIP_ADMINISTRATOR = "desdemona+admin@zulip.com" +# 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 in diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py index 0b4924d820..1028ce58f9 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 = True RATE_LIMITING = False RATE_LIMITING_AUTHENTICATE = False # Don't use RabbitMQ from the test suite -- the user_profile_ids for diff --git a/zproject/test_settings.py b/zproject/test_settings.py index f8751e3330..228cbfee6c 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: skip from .test_extra_settings import * # noqa: F403 isort: skip