ktmud commented on a change in pull request #13739:
URL: https://github.com/apache/superset/pull/13739#discussion_r605844824
##########
File path: tests/conftest.py
##########
@@ -73,13 +73,22 @@ def drop_from_schema(engine: Engine, schema_name: str):
def setup_presto_if_needed():
backend = app.config["SQLALCHEMY_EXAMPLES_URI"].split("://")[0]
+ database = get_example_database()
+ extra = database.get_extra()
+
if backend == "presto":
# decrease poll interval for tests
- presto_poll_interval = app.config["PRESTO_POLL_INTERVAL"]
- extra = f'{{"engine_params": {{"connect_args": {{"poll_interval":
{presto_poll_interval}}}}}}}'
- database = get_example_database()
- database.extra = extra
- db.session.commit()
+ extra = {
+ **extra,
+ "engine_params": {
+ "connect_args": {"poll_interval":
app.config["PRESTO_POLL_INTERVAL"]}
+ },
+ }
+ else:
+ # remove `poll_interval` from databases that do not support it
+ extra = {**extra, "engine_params": {}}
Review comment:
It's set by `setup_presto_if_needed`. We only have one database
connection for test cases, when I want to run a test multiple times with
different backend, it updates configs of the one example database connection in
Superset. This function has to update this database connection unless we delete
and re-add one every time we run a test.
`setup_presto_if_needed` shouldn't update settings for other database
backends, but it also didn't clean up itself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]