Skip to content

Commit

Permalink
added fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi committed Dec 15, 2022
1 parent 4abefe3 commit 7390186
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion tests/integration_tests/charts/data/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
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
Expand Down Expand Up @@ -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],
Expand Down
8 changes: 4 additions & 4 deletions tests/integration_tests/fixtures/energy_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down

0 comments on commit 7390186

Please sign in to comment.