Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings: Remove settings.BACKEND_DATABASE_TEMPLATE.

Zixuan James Lif994ba30b823
diff --git a/zerver/lib/test_fixtures.py b/zerver/lib/test_fixtures.py
index 7fa9a593958..d72e928ee67 100644
--- a/zerver/lib/test_fixtures.py
+++ b/zerver/lib/test_fixtures.py
@@ -26,6 +26,7 @@ from scripts.lib.zulip_tools import (
write_new_digest,
)
+BACKEND_DATABASE_TEMPLATE = "zulip_test_template"
UUID_VAR_DIR = get_dev_uuid_var_path()
IMPORTANT_FILES = [
@@ -413,7 +414,7 @@ def reset_zulip_test_database() -> None:
destroy_test_databases()
# Pointing default database to test database template, so we can instantly clone it.
- settings.DATABASES["default"]["NAME"] = settings.BACKEND_DATABASE_TEMPLATE
+ settings.DATABASES["default"]["NAME"] = BACKEND_DATABASE_TEMPLATE
connection = connections["default"]
clone_database_suffix = "clone"
connection.creation.clone_test_db(
diff --git a/zerver/lib/test_runner.py b/zerver/lib/test_runner.py
index da0cdcdd42f..88554c5d4de 100644
--- a/zerver/lib/test_runner.py
+++ b/zerver/lib/test_runner.py
@@ -22,6 +22,7 @@ from scripts.lib.zulip_tools import (
)
from zerver.lib import test_helpers
from zerver.lib.sqlalchemy_utils import get_sqlalchemy_connection
+from zerver.lib.test_fixtures import BACKEND_DATABASE_TEMPLATE
from zerver.lib.test_helpers import append_instrumentation_data, write_instrumentation_reports
# We need to pick an ID for this test-backend invocation, and store it
@@ -289,7 +290,7 @@ class Runner(DiscoverRunner):
return self.shallow_tested_templates
def setup_test_environment(self, *args: Any, **kwargs: Any) -> Any:
- settings.DATABASES["default"]["NAME"] = settings.BACKEND_DATABASE_TEMPLATE
+ settings.DATABASES["default"]["NAME"] = BACKEND_DATABASE_TEMPLATE
# We create/destroy the test databases in run_tests to avoid
# duplicate work when running in parallel mode.
diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py
index f570cd3af8a..842aeee492f 100644
--- a/zproject/test_extra_settings.py
+++ b/zproject/test_extra_settings.py
@@ -26,9 +26,6 @@ FAKE_EMAIL_DOMAIN = "zulip.testserver"
# Clear out the REALM_HOSTS set in dev_settings.py
REALM_HOSTS: Dict[str, str] = {}
-# Used to clone DBs in backend tests.
-BACKEND_DATABASE_TEMPLATE = "zulip_test_template"
-
DATABASES["default"] = {
"NAME": os.getenv("ZULIP_DB_NAME", "zulip_test"),
"USER": "zulip_test",