This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new f71ee2e7bc fix: flaky test when sync metadata (#21306)
f71ee2e7bc is described below
commit f71ee2e7bc89860f51f599a4403808f65c7430dc
Author: Yongjie Zhao <[email protected]>
AuthorDate: Fri Sep 2 17:22:49 2022 +0800
fix: flaky test when sync metadata (#21306)
---
tests/integration_tests/sqla_models_tests.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/integration_tests/sqla_models_tests.py
b/tests/integration_tests/sqla_models_tests.py
index cb98223e1d..047228355d 100644
--- a/tests/integration_tests/sqla_models_tests.py
+++ b/tests/integration_tests/sqla_models_tests.py
@@ -453,7 +453,8 @@ class TestDatabaseModel(SupersetTestCase):
# make sure the columns have been mapped properly
assert len(table.columns) == 4
- table.fetch_metadata(commit=False)
+ with db.session.no_autoflush:
+ table.fetch_metadata(commit=False)
# assert that the removed column has been dropped and
# the physical and calculated columns are present
@@ -465,15 +466,13 @@ class TestDatabaseModel(SupersetTestCase):
}
cols: Dict[str, TableColumn] = {col.column_name: col for col in
table.columns}
# assert that the type for intcol has been updated (asserting CI types)
- backend = get_example_database().backend
+ backend = table.database.backend
assert VIRTUAL_TABLE_INT_TYPES[backend].match(cols["intcol"].type)
# assert that the expression has been replaced with the new physical
column
assert cols["mycase"].expression == ""
assert VIRTUAL_TABLE_STRING_TYPES[backend].match(cols["mycase"].type)
assert cols["expr"].expression == "case when 1 then 1 else 0 end"
- db.session.delete(table)
-
@patch("superset.models.core.Database.db_engine_spec", BigQueryEngineSpec)
def test_labels_expected_on_mutated_query(self):
query_obj = {