mirror of
https://github.com/apache/superset.git
synced 2026-08-12 11:11:01 +00:00
chore: Update pre-commit packages (#23173)
This commit is contained in:
@@ -210,7 +210,6 @@ class TestPostChartDataApi(BaseTestChartDataApi):
|
||||
{**app.config, "SAMPLES_ROW_LIMIT": 5, "SQL_MAX_ROW": 15},
|
||||
)
|
||||
def test_with_row_limit_as_samples__rowcount_as_row_limit(self):
|
||||
|
||||
expected_row_count = 10
|
||||
self.query_context_payload["result_type"] = ChartDataResultType.SAMPLES
|
||||
self.query_context_payload["queries"][0]["row_limit"] = expected_row_count
|
||||
@@ -234,7 +233,6 @@ class TestPostChartDataApi(BaseTestChartDataApi):
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_with_invalid_payload__400(self):
|
||||
|
||||
invalid_query_context = {"form_data": "NOT VALID JSON"}
|
||||
|
||||
rv = self.client.post(
|
||||
@@ -585,7 +583,6 @@ class TestPostChartDataApi(BaseTestChartDataApi):
|
||||
def test_when_where_parameter_is_template_and_query_result_type__query_is_templated(
|
||||
self,
|
||||
):
|
||||
|
||||
self.query_context_payload["result_type"] = ChartDataResultType.QUERY
|
||||
self.query_context_payload["queries"][0]["filters"] = [
|
||||
{"col": "gender", "op": "==", "val": "boy"}
|
||||
|
||||
@@ -502,7 +502,6 @@ def test_failing_import_datasets_versioned_export(
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
@mock.patch("superset.tasks.thumbnails.cache_dashboard_thumbnail")
|
||||
def test_compute_thumbnails(thumbnail_mock, app_context, fs):
|
||||
|
||||
thumbnail_mock.return_value = None
|
||||
runner = app.test_cli_runner()
|
||||
dashboard = db.session.query(Dashboard).filter_by(slug="births").first()
|
||||
|
||||
@@ -200,7 +200,7 @@ def mock_upload_to_s3(filename: str, upload_prefix: str, table: Table) -> str:
|
||||
# only needed for the hive tests
|
||||
import docker
|
||||
|
||||
client = docker.from_env()
|
||||
client = docker.from_env() # type: ignore
|
||||
container = client.containers.get("namenode")
|
||||
# docker mounted volume that contains csv uploads
|
||||
src = os.path.join("/tmp/superset_uploads", os.path.basename(filename))
|
||||
|
||||
@@ -61,7 +61,6 @@ from tests.integration_tests.fixtures.importexport import (
|
||||
|
||||
|
||||
class TestDatasetApi(SupersetTestCase):
|
||||
|
||||
fixture_tables_names = ("ab_permission", "ab_permission_view", "ab_view_menu")
|
||||
fixture_virtual_table_names = ("sql_virtual_dataset_1", "sql_virtual_dataset_2")
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ class TestBigQueryDbEngineSpec(TestDbEngineSpec):
|
||||
"""
|
||||
DB Eng Specs (bigquery): Test fetch data
|
||||
"""
|
||||
|
||||
# Mock a google.cloud.bigquery.table.Row
|
||||
class Row(object):
|
||||
def __init__(self, value):
|
||||
|
||||
@@ -89,7 +89,6 @@ def _create_energy_table() -> List[Slice]:
|
||||
|
||||
slices = []
|
||||
for slice_data in _get_energy_slices():
|
||||
|
||||
slice = _create_and_commit_energy_slice(
|
||||
table,
|
||||
slice_data["slice_title"],
|
||||
|
||||
@@ -23,7 +23,6 @@ from tests.integration_tests.test_app import app
|
||||
|
||||
@pytest.fixture()
|
||||
def create_gamma_sqllab_no_data():
|
||||
|
||||
with app.app_context():
|
||||
gamma_role = db.session.query(Role).filter(Role.name == "Gamma").one_or_none()
|
||||
sqllab_role = (
|
||||
|
||||
@@ -64,7 +64,6 @@ def test_execute_query_as_report_executor(
|
||||
app_context: None,
|
||||
get_user,
|
||||
) -> None:
|
||||
|
||||
from superset.reports.commands.alert import AlertCommand
|
||||
from superset.reports.models import ReportSchedule
|
||||
|
||||
@@ -104,7 +103,6 @@ def test_execute_query_as_report_executor(
|
||||
def test_execute_query_succeeded_no_retry(
|
||||
mocker: MockFixture, app_context: None
|
||||
) -> None:
|
||||
|
||||
from superset.reports.commands.alert import AlertCommand
|
||||
|
||||
execute_query_mock = mocker.patch(
|
||||
|
||||
@@ -88,7 +88,6 @@ class TestReportSchedulesApi(SupersetTestCase):
|
||||
@pytest.fixture()
|
||||
def create_working_admin_report_schedule(self):
|
||||
with self.create_app().app_context():
|
||||
|
||||
admin_user = self.get_user("admin")
|
||||
chart = db.session.query(Slice).first()
|
||||
example_db = get_example_database()
|
||||
@@ -114,7 +113,6 @@ class TestReportSchedulesApi(SupersetTestCase):
|
||||
@pytest.fixture()
|
||||
def create_working_gamma_report_schedule(self, gamma_user_with_alerts_role):
|
||||
with self.create_app().app_context():
|
||||
|
||||
chart = db.session.query(Slice).first()
|
||||
example_db = get_example_database()
|
||||
|
||||
@@ -139,7 +137,6 @@ class TestReportSchedulesApi(SupersetTestCase):
|
||||
@pytest.fixture()
|
||||
def create_working_shared_report_schedule(self, gamma_user_with_alerts_role):
|
||||
with self.create_app().app_context():
|
||||
|
||||
admin_user = self.get_user("admin")
|
||||
alpha_user = self.get_user("alpha")
|
||||
chart = db.session.query(Slice).first()
|
||||
@@ -213,7 +210,6 @@ class TestReportSchedulesApi(SupersetTestCase):
|
||||
@pytest.fixture()
|
||||
def create_alpha_users(self):
|
||||
with self.create_app().app_context():
|
||||
|
||||
users = [
|
||||
self.create_user(
|
||||
"alpha1", "password", "Alpha", email="alpha1@superset.org"
|
||||
|
||||
@@ -466,7 +466,6 @@ def create_alert_email_chart(request):
|
||||
chart = db.session.query(Slice).first()
|
||||
example_database = get_example_database()
|
||||
with create_test_table_context(example_database):
|
||||
|
||||
report_schedule = create_report_notification(
|
||||
email_target="target@email.com",
|
||||
chart=chart,
|
||||
@@ -549,7 +548,6 @@ def create_no_alert_email_chart(request):
|
||||
chart = db.session.query(Slice).first()
|
||||
example_database = get_example_database()
|
||||
with create_test_table_context(example_database):
|
||||
|
||||
report_schedule = create_report_notification(
|
||||
email_target="target@email.com",
|
||||
chart=chart,
|
||||
@@ -584,7 +582,6 @@ def create_mul_alert_email_chart(request):
|
||||
chart = db.session.query(Slice).first()
|
||||
example_database = get_example_database()
|
||||
with create_test_table_context(example_database):
|
||||
|
||||
report_schedule = create_report_notification(
|
||||
email_target="target@email.com",
|
||||
chart=chart,
|
||||
@@ -619,7 +616,6 @@ def create_invalid_sql_alert_email_chart(request):
|
||||
chart = db.session.query(Slice).first()
|
||||
example_database = get_example_database()
|
||||
with create_test_table_context(example_database):
|
||||
|
||||
report_schedule = create_report_notification(
|
||||
email_target="target@email.com",
|
||||
chart=chart,
|
||||
@@ -1072,7 +1068,6 @@ def test_email_dashboard_report_schedule(
|
||||
|
||||
with freeze_time("2020-01-01T00:00:00Z"):
|
||||
with patch.object(current_app.config["STATS_LOGGER"], "gauge") as statsd_mock:
|
||||
|
||||
AsyncExecuteReportScheduleCommand(
|
||||
TEST_ID, create_report_email_dashboard.id, datetime.utcnow()
|
||||
).run()
|
||||
@@ -1143,7 +1138,6 @@ def test_slack_chart_report_schedule(
|
||||
|
||||
with freeze_time("2020-01-01T00:00:00Z"):
|
||||
with patch.object(current_app.config["STATS_LOGGER"], "gauge") as statsd_mock:
|
||||
|
||||
AsyncExecuteReportScheduleCommand(
|
||||
TEST_ID, create_report_slack_chart.id, datetime.utcnow()
|
||||
).run()
|
||||
@@ -1192,7 +1186,6 @@ def test_slack_chart_report_schedule_with_errors(
|
||||
web_client_mock.side_effect = er
|
||||
|
||||
with pytest.raises(ReportScheduleClientErrorsException):
|
||||
|
||||
AsyncExecuteReportScheduleCommand(
|
||||
TEST_ID, create_report_slack_chart.id, datetime.utcnow()
|
||||
).run()
|
||||
@@ -1349,7 +1342,6 @@ def test_report_schedule_working_timeout(create_report_slack_chart_working):
|
||||
seconds=create_report_slack_chart_working.working_timeout + 1
|
||||
)
|
||||
with freeze_time(current_time):
|
||||
|
||||
with pytest.raises(ReportScheduleWorkingTimeoutError):
|
||||
AsyncExecuteReportScheduleCommand(
|
||||
TEST_ID, create_report_slack_chart_working.id, datetime.utcnow()
|
||||
@@ -2020,7 +2012,6 @@ def test__send_with_multiple_errors(notification_mock, logger_mock):
|
||||
@patch("superset.reports.commands.execute.logger")
|
||||
@patch("superset.reports.commands.execute.create_notification")
|
||||
def test__send_with_server_errors(notification_mock, logger_mock):
|
||||
|
||||
notification_content = "I am some content"
|
||||
recipients = ["test@foo.com"]
|
||||
notification_mock.return_value.send.side_effect = NotificationError()
|
||||
|
||||
@@ -43,7 +43,6 @@ def test_scheduler_celery_timeout_ny(execute_mock, owners):
|
||||
Reports scheduler: Test scheduler setting celery soft and hard timeout
|
||||
"""
|
||||
with app.app_context():
|
||||
|
||||
report_schedule = insert_report_schedule(
|
||||
type=ReportScheduleType.ALERT,
|
||||
name="report",
|
||||
@@ -91,7 +90,6 @@ def test_scheduler_celery_timeout_utc(execute_mock, owners):
|
||||
Reports scheduler: Test scheduler setting celery soft and hard timeout
|
||||
"""
|
||||
with app.app_context():
|
||||
|
||||
report_schedule = insert_report_schedule(
|
||||
type=ReportScheduleType.ALERT,
|
||||
name="report",
|
||||
|
||||
@@ -152,7 +152,6 @@ class TestRowLevelSecurity(SupersetTestCase):
|
||||
@pytest.fixture()
|
||||
def create_dataset(self):
|
||||
with self.create_app().app_context():
|
||||
|
||||
dataset = SqlaTable(database_id=1, schema=None, table_name="table1")
|
||||
db.session.add(dataset)
|
||||
db.session.flush()
|
||||
|
||||
@@ -199,7 +199,6 @@ class TestWebDriverProxy(SupersetTestCase):
|
||||
|
||||
|
||||
class TestThumbnails(SupersetTestCase):
|
||||
|
||||
mock_image = b"bytes mock image"
|
||||
digest_return_value = "foo_bar"
|
||||
digest_hash = "5c7d96a3dd7a87850a2ef34087565a6e"
|
||||
|
||||
Reference in New Issue
Block a user