You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2024/06/17 21:00:08 UTC
(superset) branch fix_talisman created (now f214c9b12c)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a change to branch fix_talisman
in repository https://gitbox.apache.org/repos/asf/superset.git
at f214c9b12c chore: make flask-talisman work with test config
This branch includes the following new commits:
new f214c9b12c chore: make flask-talisman work with test config
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: chore: make flask-talisman work with test config
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch fix_talisman
in repository https://gitbox.apache.org/repos/asf/superset.git
commit f214c9b12c49f9bea85eadc99dce25c4126be2ab
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Jun 17 13:54:17 2024 -0700
chore: make flask-talisman work with test config
Currently, when setting .env-local to point to the test config, by setting `SUPERSET_CONFIG=tests.integration_tests.superset_test_config`, flask-talisman has issues where it refuses to load assets because of `safe-eval`.
This allows for the TALISMAN_CONFOG_DEV is used when making this import.
In an upcoming PR I'm planning on documenting how to point your dev docker-compose setup to the test settings and database for interactive testing.
---
docker/pythonpath_dev/superset_config.py | 1 -
scripts/tests/run.sh | 3 +++
superset/config.py | 2 +-
superset/initialization/__init__.py | 2 +-
tests/integration_tests/superset_test_config.py | 1 -
5 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/docker/pythonpath_dev/superset_config.py b/docker/pythonpath_dev/superset_config.py
index 69477d56e7..c78a504141 100644
--- a/docker/pythonpath_dev/superset_config.py
+++ b/docker/pythonpath_dev/superset_config.py
@@ -97,7 +97,6 @@ ALERT_REPORTS_NOTIFICATION_DRY_RUN = True
WEBDRIVER_BASEURL = "http://superset:8088/" # When using docker compose baseurl should be http://superset_app:8088/
# The base URL for the email report hyperlinks.
WEBDRIVER_BASEURL_USER_FRIENDLY = WEBDRIVER_BASEURL
-
SQLLAB_CTAS_NO_LIMIT = True
#
diff --git a/scripts/tests/run.sh b/scripts/tests/run.sh
index d77adc08e0..bf8431caeb 100755
--- a/scripts/tests/run.sh
+++ b/scripts/tests/run.sh
@@ -61,7 +61,10 @@ function test_init() {
DB_NAME="test"
DB_USER="superset"
DB_PASSWORD="superset"
+
+# Pointing to use the test database in local docker-compose setup
export SUPERSET__SQLALCHEMY_DATABASE_URI=${SUPERSET__SQLALCHEMY_DATABASE_URI:-postgresql+psycopg2://"${DB_USER}":"${DB_PASSWORD}"@localhost/"${DB_NAME}"}
+
export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.integration_tests.superset_test_config}
RUN_INIT=1
RUN_RESET_DB=1
diff --git a/superset/config.py b/superset/config.py
index 3dfeb3ad47..d3a4694a03 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -261,7 +261,7 @@ WTF_CSRF_EXEMPT_LIST = [
]
# Whether to run the web server in debug mode or not
-DEBUG = os.environ.get("FLASK_DEBUG")
+DEBUG = parse_boolean_string(os.environ.get("FLASK_DEBUG"))
FLASK_USE_RELOAD = True
# Enable profiling of Python calls. Turn this on and append ``?_instrument=1``
diff --git a/superset/initialization/__init__.py b/superset/initialization/__init__.py
index 65e518b7c9..a98b8c9489 100644
--- a/superset/initialization/__init__.py
+++ b/superset/initialization/__init__.py
@@ -586,7 +586,7 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
talisman_enabled = self.config["TALISMAN_ENABLED"]
talisman_config = (
self.config["TALISMAN_DEV_CONFIG"]
- if self.superset_app.debug
+ if self.superset_app.debug or self.config["DEBUG"]
else self.config["TALISMAN_CONFIG"]
)
csp_warning = self.config["CONTENT_SECURITY_POLICY_WARNING"]
diff --git a/tests/integration_tests/superset_test_config.py b/tests/integration_tests/superset_test_config.py
index e0a1123950..a23472b018 100644
--- a/tests/integration_tests/superset_test_config.py
+++ b/tests/integration_tests/superset_test_config.py
@@ -40,7 +40,6 @@ SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join( # noqa: F405
DATA_DIR,
"unittests.integration_tests.db", # noqa: F405
)
-DEBUG = False
SILENCE_FAB = False
# Allowing SQLALCHEMY_DATABASE_URI and SQLALCHEMY_EXAMPLES_URI to be defined as an env vars for
# continuous integration