diff --git a/tests/integration_tests/charts/data/api_tests.py b/tests/integration_tests/charts/data/api_tests.py index 4aba5b2e229..fe304d33924 100644 --- a/tests/integration_tests/charts/data/api_tests.py +++ b/tests/integration_tests/charts/data/api_tests.py @@ -38,8 +38,12 @@ from tests.integration_tests.fixtures.birth_names_dashboard import ( load_birth_names_data, ) from tests.integration_tests.test_app import app - +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, + load_energy_table_data, +) import pytest +from superset.models.slice import Slice from superset.charts.data.commands.get_data_command import ChartDataCommand from superset.connectors.sqla.models import TableColumn, SqlaTable @@ -1027,6 +1031,7 @@ def test_data_cache_default_timeout( def test_chart_cache_timeout( + test_client, login_as_admin, physical_query_context, load_energy_table_with_slice: List[Slice], diff --git a/tests/integration_tests/fixtures/energy_dashboard.py b/tests/integration_tests/fixtures/energy_dashboard.py index c0291db2a98..c2f82b10463 100644 --- a/tests/integration_tests/fixtures/energy_dashboard.py +++ b/tests/integration_tests/fixtures/energy_dashboard.py @@ -52,15 +52,15 @@ def load_energy_table_data(): ) yield with app.app_context(): - engine = get_example_database().get_sqla_engine() - engine.execute("DROP TABLE IF EXISTS energy_usage") + with get_example_database().get_sqla_engine_with_context() as engine: + engine.execute("DROP TABLE IF EXISTS energy_usage") @pytest.fixture() def load_energy_table_with_slice(load_energy_table_data): with app.app_context(): - _create_energy_table() - yield + slices = _create_energy_table() + yield slices _cleanup()