This is an automated email from the ASF dual-hosted git repository.
michaelsmolina 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 bbdc195a3b chore: Skips integration tests affected by legacy charts
removal (#31791)
bbdc195a3b is described below
commit bbdc195a3bbdd85640e1e02440c6668e269a6452
Author: Michael S. Molina <[email protected]>
AuthorDate: Fri Jan 10 14:53:54 2025 -0300
chore: Skips integration tests affected by legacy charts removal (#31791)
---
tests/integration_tests/async_events/api_tests.py | 2 +
tests/integration_tests/cache_tests.py | 4 +
tests/integration_tests/charts/api_tests.py | 4 +-
tests/integration_tests/charts/commands_tests.py | 2 +
tests/integration_tests/core_tests.py | 10 ++
.../integration_tests/tasks/async_queries_tests.py | 1 +
tests/integration_tests/utils_tests.py | 1 +
tests/integration_tests/viz_tests.py | 170 ---------------------
8 files changed, 23 insertions(+), 171 deletions(-)
diff --git a/tests/integration_tests/async_events/api_tests.py
b/tests/integration_tests/async_events/api_tests.py
index 80e9fa9b3b..8a3b9c3bfc 100644
--- a/tests/integration_tests/async_events/api_tests.py
+++ b/tests/integration_tests/async_events/api_tests.py
@@ -17,6 +17,7 @@
from typing import Any, Optional, Type
from unittest import mock
+import pytest
import redis
from superset.async_events.cache_backend import (
@@ -30,6 +31,7 @@ from tests.integration_tests.constants import ADMIN_USERNAME
from tests.integration_tests.test_app import app
[email protected](reason="Needs to investigate this test", allow_module_level=True)
class TestAsyncEventApi(SupersetTestCase):
UUID = "943c920-32a5-412a-977d-b8e47d36f5a4"
diff --git a/tests/integration_tests/cache_tests.py
b/tests/integration_tests/cache_tests.py
index 1356e32cd8..bec74077e1 100644
--- a/tests/integration_tests/cache_tests.py
+++ b/tests/integration_tests/cache_tests.py
@@ -29,6 +29,10 @@ from tests.integration_tests.fixtures.birth_names_dashboard
import (
load_birth_names_data, # noqa: F401
)
+pytest.skip(
+ reason="These tests will be changed to use the api/v1/data",
allow_module_level=True
+)
+
class TestCache(SupersetTestCase):
def setUp(self):
diff --git a/tests/integration_tests/charts/api_tests.py
b/tests/integration_tests/charts/api_tests.py
index 78fc28a2ad..41fd87f68b 100644
--- a/tests/integration_tests/charts/api_tests.py
+++ b/tests/integration_tests/charts/api_tests.py
@@ -1035,6 +1035,7 @@ class TestChartApi(ApiOwnersTestCaseMixin,
InsertChartMixin, SupersetTestCase):
assert response == expected_response
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_get_chart(self):
"""
Chart API: Test get chart
@@ -1170,6 +1171,7 @@ class TestChartApi(ApiOwnersTestCaseMixin,
InsertChartMixin, SupersetTestCase):
assert result[0]["slice_name"] == self.chart.slice_name
@pytest.mark.usefixtures("create_charts_some_with_tags")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_get_charts_tag_filters(self):
"""
Chart API: Test get charts with tag filters
@@ -1970,7 +1972,6 @@ class TestChartApi(ApiOwnersTestCaseMixin,
InsertChartMixin, SupersetTestCase):
@parameterized.expand(
[
- "Top 10 Girl Name Share", # Legacy chart
"Pivot Table v2", # Non-legacy chart
],
)
@@ -2096,6 +2097,7 @@ class TestChartApi(ApiOwnersTestCaseMixin,
InsertChartMixin, SupersetTestCase):
}
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_warm_up_cache_no_datasource(self) -> None:
self.login(ADMIN_USERNAME)
slc = self.get_slice("Top 10 Girl Name Share")
diff --git a/tests/integration_tests/charts/commands_tests.py
b/tests/integration_tests/charts/commands_tests.py
index bcdd79b135..3a193b40e2 100644
--- a/tests/integration_tests/charts/commands_tests.py
+++ b/tests/integration_tests/charts/commands_tests.py
@@ -389,6 +389,7 @@ class TestChartsUpdateCommand(SupersetTestCase):
@patch("superset.utils.core.g")
@patch("superset.security.manager.g")
@pytest.mark.usefixtures("load_energy_table_with_slice")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_query_context_update_command(self, mock_sm_g, mock_g):
"""
Test that a user can generate the chart query context
@@ -421,6 +422,7 @@ class TestChartWarmUpCacheCommand(SupersetTestCase):
ChartWarmUpCacheCommand(99999, None, None).run()
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_warm_up_cache(self):
slc = self.get_slice("Top 10 Girl Name Share")
result = ChartWarmUpCacheCommand(slc.id, None, None).run()
diff --git a/tests/integration_tests/core_tests.py
b/tests/integration_tests/core_tests.py
index 38b899871f..ec2f0d6bde 100644
--- a/tests/integration_tests/core_tests.py
+++ b/tests/integration_tests/core_tests.py
@@ -137,6 +137,7 @@ class TestCore(SupersetTestCase):
assert resp.status_code == 404
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_viz_cache_key(self):
self.login(ADMIN_USERNAME)
slc = self.get_slice("Top 10 Girl Name Share")
@@ -173,6 +174,7 @@ class TestCore(SupersetTestCase):
assert_admin_view_menus_in("Gamma", self.assertNotIn)
@pytest.mark.usefixtures("load_energy_table_with_slice")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_save_slice(self):
self.login(ADMIN_USERNAME)
slice_name = f"Energy Sankey" # noqa: F541
@@ -349,6 +351,7 @@ class TestCore(SupersetTestCase):
"load_birth_names_dashboard_with_slices",
"load_energy_table_with_slice",
)
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_warm_up_cache(self):
self.login(ADMIN_USERNAME)
slc = self.get_slice("Top 10 Girl Name Share")
@@ -397,6 +400,7 @@ class TestCore(SupersetTestCase):
]
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_cache_logging(self):
self.login(ADMIN_USERNAME)
store_cache_keys = app.config["STORE_CACHE_KEYS_IN_METADATA_DB"]
@@ -559,6 +563,7 @@ class TestCore(SupersetTestCase):
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_explore_json(self):
tbl_id = self.table_ids.get("birth_names")
form_data = {
@@ -582,6 +587,7 @@ class TestCore(SupersetTestCase):
assert data["rowcount"] == 2
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_explore_json_dist_bar_order(self):
tbl_id = self.table_ids.get("birth_names")
form_data = {
@@ -682,6 +688,7 @@ class TestCore(SupersetTestCase):
"superset.extensions.feature_flag_manager._feature_flags",
GLOBAL_ASYNC_QUERIES=True,
)
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_explore_json_async(self):
tbl_id = self.table_ids.get("birth_names")
form_data = {
@@ -717,6 +724,7 @@ class TestCore(SupersetTestCase):
]
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
@mock.patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
GLOBAL_ASYNC_QUERIES=True,
@@ -748,6 +756,7 @@ class TestCore(SupersetTestCase):
new_callable=mock.PropertyMock,
)
@mock.patch("superset.viz.BaseViz.force_cached",
new_callable=mock.PropertyMock)
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_explore_json_data(self, mock_force_cached, mock_cache):
tbl_id = self.table_ids.get("birth_names")
form_data = dict( # noqa: C418
@@ -786,6 +795,7 @@ class TestCore(SupersetTestCase):
"superset.utils.cache_manager.CacheManager.cache",
new_callable=mock.PropertyMock,
)
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_explore_json_data_no_login(self, mock_cache):
tbl_id = self.table_ids.get("birth_names")
form_data = dict( # noqa: C418
diff --git a/tests/integration_tests/tasks/async_queries_tests.py
b/tests/integration_tests/tasks/async_queries_tests.py
index 4462fa537b..1d9ebdf2e8 100644
--- a/tests/integration_tests/tasks/async_queries_tests.py
+++ b/tests/integration_tests/tasks/async_queries_tests.py
@@ -167,6 +167,7 @@ class TestAsyncQueries(SupersetTestCase):
]
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
@mock.patch.object(async_query_manager, "update_job")
def test_load_explore_json_into_cache(
self, cache_type, cache_backend, mock_update_job
diff --git a/tests/integration_tests/utils_tests.py
b/tests/integration_tests/utils_tests.py
index 70bebde9e3..632aff436a 100644
--- a/tests/integration_tests/utils_tests.py
+++ b/tests/integration_tests/utils_tests.py
@@ -880,6 +880,7 @@ class TestUtils(SupersetTestCase):
assert slc is None
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ @pytest.mark.skip(reason="This test will be changed to use the
api/v1/data")
def test_log_this(self) -> None:
# TODO: Add additional scenarios.
self.login(ADMIN_USERNAME)
diff --git a/tests/integration_tests/viz_tests.py
b/tests/integration_tests/viz_tests.py
index 5777cbd0f0..dde6a1dec8 100644
--- a/tests/integration_tests/viz_tests.py
+++ b/tests/integration_tests/viz_tests.py
@@ -17,7 +17,6 @@
# isort:skip_file
from datetime import datetime
import logging
-from math import nan
from unittest.mock import Mock, patch
import numpy as np
@@ -27,7 +26,6 @@ import pytest
import tests.integration_tests.test_app # noqa: F401
import superset.viz as viz
from superset import app
-from superset.constants import NULL_STRING
from superset.exceptions import QueryObjectValidationError, SpatialException
from superset.utils.core import DTTM_ALIAS
@@ -177,174 +175,6 @@ class TestBaseViz(SupersetTestCase):
app.config["DATA_CACHE_CONFIG"]["CACHE_DEFAULT_TIMEOUT"] =
data_cache_timeout
-class TestDistBarViz(SupersetTestCase):
- def test_groupby_nulls(self):
- form_data = {
- "metrics": ["votes"],
- "adhoc_filters": [],
- "groupby": ["toppings"],
- "columns": [],
- "order_desc": True,
- }
- datasource = self.get_datasource_mock()
- df = pd.DataFrame(
- {
- "toppings": ["cheese", "pepperoni", "anchovies", None],
- "votes": [3, 5, 1, 2],
- }
- )
- test_viz = viz.DistributionBarViz(datasource, form_data)
- data = test_viz.get_data(df)[0]
- assert "votes" == data["key"]
- expected_values = [
- {"x": "pepperoni", "y": 5},
- {"x": "cheese", "y": 3},
- {"x": NULL_STRING, "y": 2},
- {"x": "anchovies", "y": 1},
- ]
- assert expected_values == data["values"]
-
- def test_groupby_nans(self):
- form_data = {
- "metrics": ["count"],
- "adhoc_filters": [],
- "groupby": ["beds"],
- "columns": [],
- "order_desc": True,
- }
- datasource = self.get_datasource_mock()
- df = pd.DataFrame({"beds": [0, 1, nan, 2], "count": [30, 42, 3, 29]})
- test_viz = viz.DistributionBarViz(datasource, form_data)
- data = test_viz.get_data(df)[0]
- assert "count" == data["key"]
- expected_values = [
- {"x": "1.0", "y": 42},
- {"x": "0.0", "y": 30},
- {"x": "2.0", "y": 29},
- {"x": NULL_STRING, "y": 3},
- ]
-
- assert expected_values == data["values"]
-
- def test_column_nulls(self):
- form_data = {
- "metrics": ["votes"],
- "adhoc_filters": [],
- "groupby": ["toppings"],
- "columns": ["role"],
- "order_desc": True,
- }
- datasource = self.get_datasource_mock()
- df = pd.DataFrame(
- {
- "toppings": ["cheese", "pepperoni", "cheese", "pepperoni"],
- "role": ["engineer", "engineer", None, None],
- "votes": [3, 5, 1, 2],
- }
- )
- test_viz = viz.DistributionBarViz(datasource, form_data)
- data = test_viz.get_data(df)
- expected = [
- {
- "key": NULL_STRING,
- "values": [{"x": "pepperoni", "y": 2}, {"x": "cheese", "y":
1}],
- },
- {
- "key": "engineer",
- "values": [{"x": "pepperoni", "y": 5}, {"x": "cheese", "y":
3}],
- },
- ]
- assert expected == data
-
- def test_column_metrics_in_order(self):
- form_data = {
- "metrics": ["z_column", "votes", "a_column"],
- "adhoc_filters": [],
- "groupby": ["toppings"],
- "columns": [],
- "order_desc": True,
- }
- datasource = self.get_datasource_mock()
- df = pd.DataFrame(
- {
- "toppings": ["cheese", "pepperoni", "cheese", "pepperoni"],
- "role": ["engineer", "engineer", None, None],
- "votes": [3, 5, 1, 2],
- "a_column": [3, 5, 1, 2],
- "z_column": [3, 5, 1, 2],
- }
- )
- test_viz = viz.DistributionBarViz(datasource, form_data)
- data = test_viz.get_data(df)
-
- expected = [
- {
- "key": "z_column",
- "values": [{"x": "pepperoni", "y": 3.5}, {"x": "cheese", "y":
2.0}],
- },
- {
- "key": "votes",
- "values": [{"x": "pepperoni", "y": 3.5}, {"x": "cheese", "y":
2.0}],
- },
- {
- "key": "a_column",
- "values": [{"x": "pepperoni", "y": 3.5}, {"x": "cheese", "y":
2.0}],
- },
- ]
-
- assert expected == data
-
- def test_column_metrics_in_order_with_breakdowns(self):
- form_data = {
- "metrics": ["z_column", "votes", "a_column"],
- "adhoc_filters": [],
- "groupby": ["toppings"],
- "columns": ["role"],
- "order_desc": True,
- }
- datasource = self.get_datasource_mock()
- df = pd.DataFrame(
- {
- "toppings": ["cheese", "pepperoni", "cheese", "pepperoni"],
- "role": ["engineer", "engineer", None, None],
- "votes": [3, 5, 1, 2],
- "a_column": [3, 5, 1, 2],
- "z_column": [3, 5, 1, 2],
- }
- )
- test_viz = viz.DistributionBarViz(datasource, form_data)
- data = test_viz.get_data(df)
-
- expected = [
- {
- "key": f"z_column, {NULL_STRING}",
- "values": [{"x": "pepperoni", "y": 2}, {"x": "cheese", "y":
1}],
- },
- {
- "key": "z_column, engineer",
- "values": [{"x": "pepperoni", "y": 5}, {"x": "cheese", "y":
3}],
- },
- {
- "key": f"votes, {NULL_STRING}",
- "values": [{"x": "pepperoni", "y": 2}, {"x": "cheese", "y":
1}],
- },
- {
- "key": "votes, engineer",
- "values": [{"x": "pepperoni", "y": 5}, {"x": "cheese", "y":
3}],
- },
- {
- "key": f"a_column, {NULL_STRING}",
- "values": [{"x": "pepperoni", "y": 2}, {"x": "cheese", "y":
1}],
- },
- {
- "key": "a_column, engineer",
- "values": [{"x": "pepperoni", "y": 5}, {"x": "cheese", "y":
3}],
- },
- ]
-
- assert expected == data
-
-
class TestPairedTTest(SupersetTestCase):
def test_get_data_transforms_dataframe(self):
form_data = {