added fixtures

This commit is contained in:
AAfghahi
2022-11-17 14:05:53 -05:00
parent 4327fbc794
commit 1c77f3f8f0
2 changed files with 10 additions and 5 deletions

View File

@@ -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],

View File

@@ -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()