You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2024/06/10 15:03:22 UTC
(superset) 01/01: chore: s/MockFixture/MockerFixture/g
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch standardize-mockerfixture
in repository https://gitbox.apache.org/repos/asf/superset.git
commit acd4d81d2097066d8b48362d08fb8e0d00c12c6e
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Mon Jun 10 11:03:11 2024 -0400
chore: s/MockFixture/MockerFixture/g
---
tests/integration_tests/access_tests.py | 8 +--
tests/integration_tests/reports/alert_tests.py | 12 ++--
tests/integration_tests/sqla_models_tests.py | 4 +-
tests/integration_tests/test_jinja_context.py | 12 ++--
.../charts/commands/importers/v1/import_test.py | 12 ++--
tests/unit_tests/commands/dataset/test_update.py | 4 +-
tests/unit_tests/commands/export_test.py | 4 +-
.../commands/importers/v1/assets_test.py | 8 +--
tests/unit_tests/conftest.py | 6 +-
tests/unit_tests/dao/queries_test.py | 10 +--
.../commands/importers/v1/import_test.py | 12 ++--
tests/unit_tests/databases/api_test.py | 84 +++++++++++-----------
.../databases/commands/importers/v1/import_test.py | 12 ++--
tests/unit_tests/databases/schema_tests.py | 4 +-
.../databases/ssh_tunnel/commands/delete_test.py | 4 +-
.../datasets/commands/importers/v1/import_test.py | 14 ++--
tests/unit_tests/db_engine_specs/test_base.py | 10 +--
tests/unit_tests/db_engine_specs/test_bigquery.py | 6 +-
tests/unit_tests/db_engine_specs/test_gsheets.py | 22 +++---
tests/unit_tests/db_engine_specs/test_init.py | 6 +-
tests/unit_tests/db_engine_specs/test_postgres.py | 4 +-
tests/unit_tests/explore/utils_test.py | 28 ++++----
tests/unit_tests/extensions/test_sqlalchemy.py | 14 ++--
tests/unit_tests/feature_flag_test.py | 8 +--
tests/unit_tests/importexport/api_test.py | 14 ++--
tests/unit_tests/jinja_context_test.py | 36 +++++-----
tests/unit_tests/models/core_test.py | 20 +++---
tests/unit_tests/models/sql_lab_test.py | 4 +-
tests/unit_tests/reports/schemas_test.py | 4 +-
tests/unit_tests/security/manager_test.py | 26 +++----
tests/unit_tests/tags/commands/create_test.py | 6 +-
tests/unit_tests/tags/commands/update_test.py | 8 +--
32 files changed, 213 insertions(+), 213 deletions(-)
diff --git a/tests/integration_tests/access_tests.py b/tests/integration_tests/access_tests.py
index f436a82dae..2b439e8873 100644
--- a/tests/integration_tests/access_tests.py
+++ b/tests/integration_tests/access_tests.py
@@ -22,7 +22,7 @@ from typing import Optional
import pytest
from flask.ctx import AppContext
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy import inspect # noqa: F401
from tests.integration_tests.fixtures.birth_names_dashboard import (
@@ -90,7 +90,7 @@ SCHEMA_ACCESS_ROLE = "schema_access_role"
)
def test_get_user_id(
app_context: AppContext,
- mocker: MockFixture,
+ mocker: MockerFixture,
username: Optional[str],
user_id: Optional[int],
) -> None:
@@ -109,7 +109,7 @@ def test_get_user_id(
)
def test_get_username(
app_context: AppContext,
- mocker: MockFixture,
+ mocker: MockerFixture,
username: Optional[str],
) -> None:
mock_g = mocker.patch("superset.utils.core.g", spec={})
@@ -121,7 +121,7 @@ def test_get_username(
@pytest.mark.parametrize("force", [False, True])
def test_override_user(
app_context: AppContext,
- mocker: MockFixture,
+ mocker: MockerFixture,
username: str,
force: bool,
) -> None:
diff --git a/tests/integration_tests/reports/alert_tests.py b/tests/integration_tests/reports/alert_tests.py
index b364c72015..87286259fa 100644
--- a/tests/integration_tests/reports/alert_tests.py
+++ b/tests/integration_tests/reports/alert_tests.py
@@ -21,7 +21,7 @@ from typing import Optional, Union
import pandas as pd
import pytest
from flask.ctx import AppContext
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset.commands.report.exceptions import AlertQueryError
from superset.reports.models import ReportCreationMethod, ReportScheduleType
@@ -61,7 +61,7 @@ def test_execute_query_as_report_executor(
creator_name: Optional[str],
config: list[ExecutorType],
expected_result: Union[tuple[ExecutorType, str], Exception],
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: AppContext,
get_user,
) -> None:
@@ -99,7 +99,7 @@ def test_execute_query_as_report_executor(
def test_execute_query_succeeded_no_retry(
- mocker: MockFixture, app_context: None
+ mocker: MockerFixture, app_context: None
) -> None:
from superset.commands.report.alert import AlertCommand
@@ -116,7 +116,7 @@ def test_execute_query_succeeded_no_retry(
def test_execute_query_succeeded_with_retries(
- mocker: MockFixture, app_context: None
+ mocker: MockerFixture, app_context: None
) -> None:
from superset.commands.report.alert import AlertCommand, AlertQueryError
@@ -147,7 +147,7 @@ def test_execute_query_succeeded_with_retries(
assert execute_query_mock.call_count == expected_max_retries
-def test_execute_query_failed_no_retry(mocker: MockFixture, app_context: None) -> None:
+def test_execute_query_failed_no_retry(mocker: MockerFixture, app_context: None) -> None:
from superset.commands.report.alert import AlertCommand, AlertQueryTimeout
execute_query_mock = mocker.patch(
@@ -168,7 +168,7 @@ def test_execute_query_failed_no_retry(mocker: MockFixture, app_context: None) -
def test_execute_query_failed_max_retries(
- mocker: MockFixture, app_context: None
+ mocker: MockerFixture, app_context: None
) -> None:
from superset.commands.report.alert import AlertCommand, AlertQueryError
diff --git a/tests/integration_tests/sqla_models_tests.py b/tests/integration_tests/sqla_models_tests.py
index b6131f32bb..f0fa70bc02 100644
--- a/tests/integration_tests/sqla_models_tests.py
+++ b/tests/integration_tests/sqla_models_tests.py
@@ -25,7 +25,7 @@ import pytest
import numpy as np
import pandas as pd
from flask.ctx import AppContext
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.sql import text
from sqlalchemy.sql.elements import TextClause
@@ -856,7 +856,7 @@ def test_none_operand_in_filter(login_as_admin, physical_dataset):
],
)
def test__normalize_prequery_result_type(
- mocker: MockFixture,
+ mocker: MockerFixture,
row: pd.Series,
dimension: str,
result: Any,
diff --git a/tests/integration_tests/test_jinja_context.py b/tests/integration_tests/test_jinja_context.py
index 6ebded7787..e15c9fab9e 100644
--- a/tests/integration_tests/test_jinja_context.py
+++ b/tests/integration_tests/test_jinja_context.py
@@ -19,7 +19,7 @@ from unittest import mock
import pytest
from flask.ctx import AppContext
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
import superset.utils.database
from superset.exceptions import SupersetTemplateException
@@ -109,7 +109,7 @@ def test_template_kwarg_nested_module(app_context: AppContext) -> None:
tp.process_template(template, foo={"bar": datetime})
-def test_template_hive(app_context: AppContext, mocker: MockFixture) -> None:
+def test_template_hive(app_context: AppContext, mocker: MockerFixture) -> None:
lp_mock = mocker.patch(
"superset.jinja_context.HiveTemplateProcessor.latest_partition"
)
@@ -121,7 +121,7 @@ def test_template_hive(app_context: AppContext, mocker: MockFixture) -> None:
assert tp.process_template(template) == "the_latest"
-def test_template_spark(app_context: AppContext, mocker: MockFixture) -> None:
+def test_template_spark(app_context: AppContext, mocker: MockerFixture) -> None:
lp_mock = mocker.patch(
"superset.jinja_context.SparkTemplateProcessor.latest_partition"
)
@@ -138,7 +138,7 @@ def test_template_spark(app_context: AppContext, mocker: MockFixture) -> None:
assert tp.process_template(template) == "the_latest"
-def test_template_trino(app_context: AppContext, mocker: MockFixture) -> None:
+def test_template_trino(app_context: AppContext, mocker: MockerFixture) -> None:
lp_mock = mocker.patch(
"superset.jinja_context.TrinoTemplateProcessor.latest_partition"
)
@@ -155,7 +155,7 @@ def test_template_trino(app_context: AppContext, mocker: MockFixture) -> None:
assert tp.process_template(template) == "the_latest"
-def test_template_context_addons(app_context: AppContext, mocker: MockFixture) -> None:
+def test_template_context_addons(app_context: AppContext, mocker: MockerFixture) -> None:
addons_mock = mocker.patch("superset.jinja_context.context_addons")
addons_mock.return_value = {"datetime": datetime}
maindb = superset.utils.database.get_example_database()
@@ -164,7 +164,7 @@ def test_template_context_addons(app_context: AppContext, mocker: MockFixture) -
assert tp.process_template(template) == "SELECT '2017-01-01T00:00:00'"
-def test_custom_process_template(app_context: AppContext, mocker: MockFixture) -> None:
+def test_custom_process_template(app_context: AppContext, mocker: MockerFixture) -> None:
"""Test macro defined in custom template processor works."""
mock_dt = mocker.patch(
diff --git a/tests/unit_tests/charts/commands/importers/v1/import_test.py b/tests/unit_tests/charts/commands/importers/v1/import_test.py
index 4e1a3703cb..ddeb2c7431 100644
--- a/tests/unit_tests/charts/commands/importers/v1/import_test.py
+++ b/tests/unit_tests/charts/commands/importers/v1/import_test.py
@@ -21,7 +21,7 @@ from collections.abc import Generator
import pytest
from flask_appbuilder.security.sqla.models import Role, User
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset import security_manager
@@ -71,7 +71,7 @@ def session_with_schema(session: Session) -> Generator[Session, None, None]:
yield session
-def test_import_chart(mocker: MockFixture, session_with_schema: Session) -> None:
+def test_import_chart(mocker: MockerFixture, session_with_schema: Session) -> None:
"""
Test importing a chart.
"""
@@ -93,7 +93,7 @@ def test_import_chart(mocker: MockFixture, session_with_schema: Session) -> None
def test_import_chart_managed_externally(
- mocker: MockFixture, session_with_schema: Session
+ mocker: MockerFixture, session_with_schema: Session
) -> None:
"""
Test importing a chart that is managed externally.
@@ -115,7 +115,7 @@ def test_import_chart_managed_externally(
def test_import_chart_without_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
session_with_schema: Session,
) -> None:
"""
@@ -156,7 +156,7 @@ def test_filter_chart_annotations(session: Session) -> None:
def test_import_existing_chart_without_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
session_with_data: Session,
) -> None:
"""
@@ -185,7 +185,7 @@ def test_import_existing_chart_without_permission(
def test_import_existing_chart_with_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
session_with_data: Session,
) -> None:
"""
diff --git a/tests/unit_tests/commands/dataset/test_update.py b/tests/unit_tests/commands/dataset/test_update.py
index 59d43de6fd..9e99edf204 100644
--- a/tests/unit_tests/commands/dataset/test_update.py
+++ b/tests/unit_tests/commands/dataset/test_update.py
@@ -17,7 +17,7 @@
from unittest.mock import MagicMock
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset import db
from superset.commands.dataset.exceptions import DatasetInvalidError
@@ -27,7 +27,7 @@ from superset.models.core import Database
@pytest.mark.usefixture("session")
-def test_update_uniqueness_error(mocker: MockFixture) -> None:
+def test_update_uniqueness_error(mocker: MockerFixture) -> None:
SqlaTable.metadata.create_all(db.session.get_bind())
database = Database(database_name="my_db", sqlalchemy_uri="sqlite://")
bar = SqlaTable(table_name="bar", schema="foo", database=database)
diff --git a/tests/unit_tests/commands/export_test.py b/tests/unit_tests/commands/export_test.py
index 68f6a821b6..4ce3545738 100644
--- a/tests/unit_tests/commands/export_test.py
+++ b/tests/unit_tests/commands/export_test.py
@@ -17,10 +17,10 @@
# pylint: disable=invalid-name, unused-argument, import-outside-toplevel
from freezegun import freeze_time
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
-def test_export_assets_command(mocker: MockFixture) -> None:
+def test_export_assets_command(mocker: MockerFixture) -> None:
"""
Test that all assets are exported correctly.
"""
diff --git a/tests/unit_tests/commands/importers/v1/assets_test.py b/tests/unit_tests/commands/importers/v1/assets_test.py
index 9609b0b45c..620e34e67d 100644
--- a/tests/unit_tests/commands/importers/v1/assets_test.py
+++ b/tests/unit_tests/commands/importers/v1/assets_test.py
@@ -17,7 +17,7 @@
import copy
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from sqlalchemy.sql import select
@@ -31,7 +31,7 @@ from tests.unit_tests.fixtures.assets_configs import (
)
-def test_import_new_assets(mocker: MockFixture, session: Session) -> None:
+def test_import_new_assets(mocker: MockerFixture, session: Session) -> None:
"""
Test that all new assets are imported correctly.
"""
@@ -63,7 +63,7 @@ def test_import_new_assets(mocker: MockFixture, session: Session) -> None:
assert len(dashboard_ids) == expected_number_of_dashboards
-def test_import_adds_dashboard_charts(mocker: MockFixture, session: Session) -> None:
+def test_import_adds_dashboard_charts(mocker: MockerFixture, session: Session) -> None:
"""
Test that existing dashboards are updated with new charts.
"""
@@ -102,7 +102,7 @@ def test_import_adds_dashboard_charts(mocker: MockFixture, session: Session) ->
assert len(dashboard_ids) == expected_number_of_dashboards
-def test_import_removes_dashboard_charts(mocker: MockFixture, session: Session) -> None:
+def test_import_removes_dashboard_charts(mocker: MockerFixture, session: Session) -> None:
"""
Test that existing dashboards are updated without old charts.
"""
diff --git a/tests/unit_tests/conftest.py b/tests/unit_tests/conftest.py
index 2b8f39d6dd..e82c4cf53c 100644
--- a/tests/unit_tests/conftest.py
+++ b/tests/unit_tests/conftest.py
@@ -25,7 +25,7 @@ from unittest.mock import patch
import pytest
from _pytest.fixtures import SubRequest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.session import Session
@@ -39,7 +39,7 @@ from superset.initialization import SupersetAppInitializer
@pytest.fixture
-def get_session(mocker: MockFixture) -> Callable[[], Session]:
+def get_session(mocker: MockerFixture) -> Callable[[], Session]:
"""
Create an in-memory SQLite db.session.to test models.
"""
@@ -141,7 +141,7 @@ def app_context(app: SupersetApp) -> Iterator[None]:
@pytest.fixture
-def full_api_access(mocker: MockFixture) -> Iterator[None]:
+def full_api_access(mocker: MockerFixture) -> Iterator[None]:
"""
Allow full access to the API.
diff --git a/tests/unit_tests/dao/queries_test.py b/tests/unit_tests/dao/queries_test.py
index eb84b288fd..dba2f62ae6 100644
--- a/tests/unit_tests/dao/queries_test.py
+++ b/tests/unit_tests/dao/queries_test.py
@@ -18,7 +18,7 @@ from datetime import datetime, timedelta
from typing import Any
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset.exceptions import QueryNotFoundException, SupersetCancelQueryException
@@ -116,7 +116,7 @@ def test_query_dao_get_queries_changed_after(session: Session) -> None:
def test_query_dao_stop_query_not_found(
- mocker: MockFixture, app: Any, session: Session
+ mocker: MockerFixture, app: Any, session: Session
) -> None:
from superset import db
from superset.common.db_query_status import QueryStatus
@@ -159,7 +159,7 @@ def test_query_dao_stop_query_not_found(
def test_query_dao_stop_query_not_running(
- mocker: MockFixture, app: Any, session: Session
+ mocker: MockerFixture, app: Any, session: Session
) -> None:
from superset import db
from superset.common.db_query_status import QueryStatus
@@ -198,7 +198,7 @@ def test_query_dao_stop_query_not_running(
def test_query_dao_stop_query_failed(
- mocker: MockFixture, app: Any, session: Session
+ mocker: MockerFixture, app: Any, session: Session
) -> None:
from superset import db
from superset.common.db_query_status import QueryStatus
@@ -240,7 +240,7 @@ def test_query_dao_stop_query_failed(
assert query.status == QueryStatus.RUNNING
-def test_query_dao_stop_query(mocker: MockFixture, app: Any, session: Session) -> None:
+def test_query_dao_stop_query(mocker: MockerFixture, app: Any, session: Session) -> None:
from superset import db
from superset.common.db_query_status import QueryStatus
from superset.models.core import Database
diff --git a/tests/unit_tests/dashboards/commands/importers/v1/import_test.py b/tests/unit_tests/dashboards/commands/importers/v1/import_test.py
index 208b723432..03f4e9fd30 100644
--- a/tests/unit_tests/dashboards/commands/importers/v1/import_test.py
+++ b/tests/unit_tests/dashboards/commands/importers/v1/import_test.py
@@ -21,7 +21,7 @@ from collections.abc import Generator
import pytest
from flask_appbuilder.security.sqla.models import Role, User
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset import security_manager
@@ -61,7 +61,7 @@ def session_with_schema(session: Session) -> Generator[Session, None, None]:
session.rollback()
-def test_import_dashboard(mocker: MockFixture, session_with_schema: Session) -> None:
+def test_import_dashboard(mocker: MockerFixture, session_with_schema: Session) -> None:
"""
Test importing a dashboard.
"""
@@ -77,7 +77,7 @@ def test_import_dashboard(mocker: MockFixture, session_with_schema: Session) ->
def test_import_dashboard_managed_externally(
- mocker: MockFixture,
+ mocker: MockerFixture,
session_with_schema: Session,
) -> None:
"""
@@ -97,7 +97,7 @@ def test_import_dashboard_managed_externally(
def test_import_dashboard_without_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
session_with_schema: Session,
) -> None:
"""
@@ -117,7 +117,7 @@ def test_import_dashboard_without_permission(
def test_import_existing_dashboard_without_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
session_with_data: Session,
) -> None:
"""
@@ -146,7 +146,7 @@ def test_import_existing_dashboard_without_permission(
def test_import_existing_dashboard_with_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
session_with_data: Session,
) -> None:
"""
diff --git a/tests/unit_tests/databases/api_test.py b/tests/unit_tests/databases/api_test.py
index 43bc085405..87c049d6e2 100644
--- a/tests/unit_tests/databases/api_test.py
+++ b/tests/unit_tests/databases/api_test.py
@@ -28,7 +28,7 @@ from uuid import UUID
import pytest
from flask import current_app
from freezegun import freeze_time
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset import db
@@ -120,7 +120,7 @@ def test_post_with_uuid(
def test_password_mask(
- mocker: MockFixture,
+ mocker: MockerFixture,
app: Any,
session: Session,
client: Any,
@@ -176,7 +176,7 @@ def test_password_mask(
def test_database_connection(
- mocker: MockFixture,
+ mocker: MockerFixture,
app: Any,
session: Session,
client: Any,
@@ -409,7 +409,7 @@ def test_non_zip_import(client: Any, full_api_access: None) -> None:
def test_delete_ssh_tunnel(
- mocker: MockFixture,
+ mocker: MockerFixture,
app: Any,
session: Session,
client: Any,
@@ -487,7 +487,7 @@ def test_delete_ssh_tunnel(
def test_delete_ssh_tunnel_not_found(
- mocker: MockFixture,
+ mocker: MockerFixture,
app: Any,
session: Session,
client: Any,
@@ -563,7 +563,7 @@ def test_delete_ssh_tunnel_not_found(
def test_apply_dynamic_database_filter(
- mocker: MockFixture,
+ mocker: MockerFixture,
app: Any,
session: Session,
client: Any,
@@ -659,7 +659,7 @@ def test_apply_dynamic_database_filter(
def test_oauth2_happy_path(
- mocker: MockFixture,
+ mocker: MockerFixture,
session: Session,
client: Any,
full_api_access: None,
@@ -727,7 +727,7 @@ def test_oauth2_happy_path(
def test_oauth2_multiple_tokens(
- mocker: MockFixture,
+ mocker: MockerFixture,
session: Session,
client: Any,
full_api_access: None,
@@ -807,7 +807,7 @@ def test_oauth2_multiple_tokens(
def test_oauth2_error(
- mocker: MockFixture,
+ mocker: MockerFixture,
session: Session,
client: Any,
full_api_access: None,
@@ -930,7 +930,7 @@ def test_csv_upload(
payload: dict[str, Any],
upload_called_with: tuple[int, str, Any, dict[str, Any]],
reader_called_with: dict[str, Any],
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1070,7 +1070,7 @@ def test_csv_upload(
def test_csv_upload_validation(
payload: Any,
expected_response: dict[str, str],
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1089,7 +1089,7 @@ def test_csv_upload_validation(
def test_csv_upload_file_size_validation(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1131,7 +1131,7 @@ def test_csv_upload_file_size_validation(
)
def test_csv_upload_file_extension_invalid(
filename: str,
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1167,7 +1167,7 @@ def test_csv_upload_file_extension_invalid(
)
def test_csv_upload_file_extension_valid(
filename: str,
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1272,7 +1272,7 @@ def test_excel_upload(
payload: dict[str, Any],
upload_called_with: tuple[int, str, Any, dict[str, Any]],
reader_called_with: dict[str, Any],
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1367,7 +1367,7 @@ def test_excel_upload(
def test_excel_upload_validation(
payload: Any,
expected_response: dict[str, str],
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1402,7 +1402,7 @@ def test_excel_upload_validation(
)
def test_excel_upload_file_extension_invalid(
filename: str,
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1478,7 +1478,7 @@ def test_columnar_upload(
payload: dict[str, Any],
upload_called_with: tuple[int, str, Any, dict[str, Any]],
reader_called_with: dict[str, Any],
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1544,7 +1544,7 @@ def test_columnar_upload(
def test_columnar_upload_validation(
payload: Any,
expected_response: dict[str, str],
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1574,7 +1574,7 @@ def test_columnar_upload_validation(
)
def test_columnar_upload_file_extension_valid(
filename: str,
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1610,7 +1610,7 @@ def test_columnar_upload_file_extension_valid(
)
def test_columnar_upload_file_extension_invalid(
filename: str,
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1630,7 +1630,7 @@ def test_columnar_upload_file_extension_invalid(
assert response.json == {"message": {"file": ["File extension is not allowed."]}}
-def test_csv_metadata(mocker: MockFixture, client: Any, full_api_access: None) -> None:
+def test_csv_metadata(mocker: MockerFixture, client: Any, full_api_access: None) -> None:
_ = mocker.patch.object(CSVReader, "file_metadata")
response = client.post(
"/api/v1/database/csv_metadata/",
@@ -1641,7 +1641,7 @@ def test_csv_metadata(mocker: MockFixture, client: Any, full_api_access: None) -
def test_csv_metadata_bad_extension(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(CSVReader, "file_metadata")
response = client.post(
@@ -1654,7 +1654,7 @@ def test_csv_metadata_bad_extension(
def test_csv_metadata_validation(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(CSVReader, "file_metadata")
response = client.post(
@@ -1667,7 +1667,7 @@ def test_csv_metadata_validation(
def test_excel_metadata(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(ExcelReader, "file_metadata")
response = client.post(
@@ -1679,7 +1679,7 @@ def test_excel_metadata(
def test_excel_metadata_bad_extension(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(ExcelReader, "file_metadata")
response = client.post(
@@ -1692,7 +1692,7 @@ def test_excel_metadata_bad_extension(
def test_excel_metadata_validation(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(ExcelReader, "file_metadata")
response = client.post(
@@ -1705,7 +1705,7 @@ def test_excel_metadata_validation(
def test_columnar_metadata(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(ColumnarReader, "file_metadata")
response = client.post(
@@ -1717,7 +1717,7 @@ def test_columnar_metadata(
def test_columnar_metadata_bad_extension(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(ColumnarReader, "file_metadata")
response = client.post(
@@ -1730,7 +1730,7 @@ def test_columnar_metadata_bad_extension(
def test_columnar_metadata_validation(
- mocker: MockFixture, client: Any, full_api_access: None
+ mocker: MockerFixture, client: Any, full_api_access: None
) -> None:
_ = mocker.patch.object(ColumnarReader, "file_metadata")
response = client.post(
@@ -1743,7 +1743,7 @@ def test_columnar_metadata_validation(
def test_table_metadata_happy_path(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1784,7 +1784,7 @@ def test_table_metadata_happy_path(
def test_table_metadata_no_table(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1817,7 +1817,7 @@ def test_table_metadata_no_table(
def test_table_metadata_slashes(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1837,7 +1837,7 @@ def test_table_metadata_slashes(
def test_table_metadata_invalid_database(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1872,7 +1872,7 @@ def test_table_metadata_invalid_database(
def test_table_metadata_unauthorized(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1907,7 +1907,7 @@ def test_table_metadata_unauthorized(
def test_table_extra_metadata_happy_path(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1948,7 +1948,7 @@ def test_table_extra_metadata_happy_path(
def test_table_extra_metadata_no_table(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -1981,7 +1981,7 @@ def test_table_extra_metadata_no_table(
def test_table_extra_metadata_slashes(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -2001,7 +2001,7 @@ def test_table_extra_metadata_slashes(
def test_table_extra_metadata_invalid_database(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -2036,7 +2036,7 @@ def test_table_extra_metadata_invalid_database(
def test_table_extra_metadata_unauthorized(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -2071,7 +2071,7 @@ def test_table_extra_metadata_unauthorized(
def test_catalogs(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -2111,7 +2111,7 @@ def test_catalogs(
def test_schemas(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
diff --git a/tests/unit_tests/databases/commands/importers/v1/import_test.py b/tests/unit_tests/databases/commands/importers/v1/import_test.py
index bf1237cd9e..65773e0721 100644
--- a/tests/unit_tests/databases/commands/importers/v1/import_test.py
+++ b/tests/unit_tests/databases/commands/importers/v1/import_test.py
@@ -19,7 +19,7 @@
import copy
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset import db
@@ -27,7 +27,7 @@ from superset.commands.exceptions import ImportFailedError
from superset.utils import json
-def test_import_database(mocker: MockFixture, session: Session) -> None:
+def test_import_database(mocker: MockerFixture, session: Session) -> None:
"""
Test importing a database.
"""
@@ -67,7 +67,7 @@ def test_import_database(mocker: MockFixture, session: Session) -> None:
assert database.allow_dml is False
-def test_import_database_sqlite_invalid(mocker: MockFixture, session: Session) -> None:
+def test_import_database_sqlite_invalid(mocker: MockerFixture, session: Session) -> None:
"""
Test importing a database.
"""
@@ -94,7 +94,7 @@ def test_import_database_sqlite_invalid(mocker: MockFixture, session: Session) -
def test_import_database_managed_externally(
- mocker: MockFixture,
+ mocker: MockerFixture,
session: Session,
) -> None:
"""
@@ -120,7 +120,7 @@ def test_import_database_managed_externally(
def test_import_database_without_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
session: Session,
) -> None:
"""
@@ -146,7 +146,7 @@ def test_import_database_without_permission(
)
-def test_import_database_with_version(mocker: MockFixture, session: Session) -> None:
+def test_import_database_with_version(mocker: MockerFixture, session: Session) -> None:
"""
Test importing a database with a version set.
"""
diff --git a/tests/unit_tests/databases/schema_tests.py b/tests/unit_tests/databases/schema_tests.py
index aac7a3e3ae..864f9d3f06 100644
--- a/tests/unit_tests/databases/schema_tests.py
+++ b/tests/unit_tests/databases/schema_tests.py
@@ -21,7 +21,7 @@ from typing import TYPE_CHECKING
import pytest
from marshmallow import fields, Schema, ValidationError
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
if TYPE_CHECKING:
from superset.databases.schemas import DatabaseParametersSchemaMixin
@@ -48,7 +48,7 @@ def dummy_schema() -> "DatabaseParametersSchemaMixin":
@pytest.fixture
-def dummy_engine(mocker: MockFixture) -> None:
+def dummy_engine(mocker: MockerFixture) -> None:
"""
Fixture proving a dummy DB engine spec.
"""
diff --git a/tests/unit_tests/databases/ssh_tunnel/commands/delete_test.py b/tests/unit_tests/databases/ssh_tunnel/commands/delete_test.py
index 78f9c1142c..ba1c874276 100644
--- a/tests/unit_tests/databases/ssh_tunnel/commands/delete_test.py
+++ b/tests/unit_tests/databases/ssh_tunnel/commands/delete_test.py
@@ -18,7 +18,7 @@
from collections.abc import Iterator
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
@@ -52,7 +52,7 @@ def session_with_data(session: Session) -> Iterator[Session]:
def test_delete_ssh_tunnel_command(
- mocker: MockFixture, session_with_data: Session
+ mocker: MockerFixture, session_with_data: Session
) -> None:
from superset.commands.database.ssh_tunnel.delete import DeleteSSHTunnelCommand
from superset.daos.database import DatabaseDAO
diff --git a/tests/unit_tests/datasets/commands/importers/v1/import_test.py b/tests/unit_tests/datasets/commands/importers/v1/import_test.py
index 97fef4866f..00a5fce5c8 100644
--- a/tests/unit_tests/datasets/commands/importers/v1/import_test.py
+++ b/tests/unit_tests/datasets/commands/importers/v1/import_test.py
@@ -24,7 +24,7 @@ from unittest.mock import Mock, patch
import pytest
from flask import current_app
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset import db
@@ -35,7 +35,7 @@ from superset.commands.dataset.importers.v1.utils import validate_data_uri
from superset.utils import json
-def test_import_dataset(mocker: MockFixture, session: Session) -> None:
+def test_import_dataset(mocker: MockerFixture, session: Session) -> None:
"""
Test importing a dataset.
"""
@@ -152,7 +152,7 @@ def test_import_dataset(mocker: MockFixture, session: Session) -> None:
assert sqla_table.database.id == database.id
-def test_import_dataset_duplicate_column(mocker: MockFixture, session: Session) -> None:
+def test_import_dataset_duplicate_column(mocker: MockerFixture, session: Session) -> None:
"""
Test importing a dataset with a column that already exists.
"""
@@ -277,7 +277,7 @@ def test_import_dataset_duplicate_column(mocker: MockFixture, session: Session)
assert sqla_table.database.id == database.id
-def test_import_column_extra_is_string(mocker: MockFixture, session: Session) -> None:
+def test_import_column_extra_is_string(mocker: MockerFixture, session: Session) -> None:
"""
Test importing a dataset when the column extra is a string.
"""
@@ -361,7 +361,7 @@ def test_import_column_extra_is_string(mocker: MockFixture, session: Session) ->
def test_import_dataset_extra_empty_string(
- mocker: MockFixture, session: Session
+ mocker: MockerFixture, session: Session
) -> None:
"""
Test importing a dataset when the extra field is an empty string.
@@ -426,7 +426,7 @@ def test_import_dataset_extra_empty_string(
@patch("superset.commands.dataset.importers.v1.utils.request")
def test_import_column_allowed_data_url(
request: Mock,
- mocker: MockFixture,
+ mocker: MockerFixture,
session: Session,
) -> None:
"""
@@ -503,7 +503,7 @@ def test_import_column_allowed_data_url(
def test_import_dataset_managed_externally(
- mocker: MockFixture,
+ mocker: MockerFixture,
session: Session,
) -> None:
"""
diff --git a/tests/unit_tests/db_engine_specs/test_base.py b/tests/unit_tests/db_engine_specs/test_base.py
index 0950dcb439..a3920c8916 100644
--- a/tests/unit_tests/db_engine_specs/test_base.py
+++ b/tests/unit_tests/db_engine_specs/test_base.py
@@ -23,7 +23,7 @@ from textwrap import dedent
from typing import Any
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy import types
from sqlalchemy.dialects import sqlite
from sqlalchemy.engine.url import URL
@@ -74,7 +74,7 @@ def test_parse_sql_multi_statement() -> None:
]
-def test_validate_db_uri(mocker: MockFixture) -> None:
+def test_validate_db_uri(mocker: MockerFixture) -> None:
"""
Ensures that the `validate_database_uri` method invokes the validator correctly
"""
@@ -197,7 +197,7 @@ def test_convert_inspector_columns(
assert convert_inspector_columns(cols) == expected_result
-def test_select_star(mocker: MockFixture) -> None:
+def test_select_star(mocker: MockerFixture) -> None:
"""
Test the ``select_star`` method.
"""
@@ -267,7 +267,7 @@ FROM my_table"""
)
-def test_extra_table_metadata(mocker: MockFixture) -> None:
+def test_extra_table_metadata(mocker: MockerFixture) -> None:
"""
Test the deprecated `extra_table_metadata` method.
"""
@@ -303,7 +303,7 @@ def test_extra_table_metadata(mocker: MockFixture) -> None:
warnings.warn.assert_called()
-def test_get_default_catalog(mocker: MockFixture) -> None:
+def test_get_default_catalog(mocker: MockerFixture) -> None:
"""
Test the `get_default_catalog` method.
"""
diff --git a/tests/unit_tests/db_engine_specs/test_bigquery.py b/tests/unit_tests/db_engine_specs/test_bigquery.py
index b96c92f328..1a61730576 100644
--- a/tests/unit_tests/db_engine_specs/test_bigquery.py
+++ b/tests/unit_tests/db_engine_specs/test_bigquery.py
@@ -21,7 +21,7 @@ from datetime import datetime
from typing import Optional
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy import select
from sqlalchemy.engine.url import make_url
from sqlalchemy.sql import sqltypes
@@ -86,7 +86,7 @@ def test_get_fields() -> None:
)
-def test_select_star(mocker: MockFixture) -> None:
+def test_select_star(mocker: MockerFixture) -> None:
"""
Test the ``select_star`` method.
@@ -336,7 +336,7 @@ def test_convert_dttm(
assert_convert_dttm(spec, target_type, expected_result, dttm)
-def test_get_default_catalog(mocker: MockFixture) -> None:
+def test_get_default_catalog(mocker: MockerFixture) -> None:
"""
Test that we get the default catalog from the connection URI.
"""
diff --git a/tests/unit_tests/db_engine_specs/test_gsheets.py b/tests/unit_tests/db_engine_specs/test_gsheets.py
index caa5414f9c..fe8230ac95 100644
--- a/tests/unit_tests/db_engine_specs/test_gsheets.py
+++ b/tests/unit_tests/db_engine_specs/test_gsheets.py
@@ -22,7 +22,7 @@ from urllib.parse import parse_qs, urlparse
import pandas as pd
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.engine.url import make_url
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
@@ -91,7 +91,7 @@ def test_validate_parameters_simple_with_in_root_catalog() -> None:
def test_validate_parameters_catalog(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
from superset.db_engine_specs.gsheets import (
GSheetsEngineSpec,
@@ -181,7 +181,7 @@ def test_validate_parameters_catalog(
def test_validate_parameters_catalog_and_credentials(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
from superset.db_engine_specs.gsheets import (
GSheetsEngineSpec,
@@ -321,7 +321,7 @@ def test_unmask_encrypted_extra_when_new_is_none() -> None:
assert GSheetsEngineSpec.unmask_encrypted_extra(old, new) is None
-def test_upload_new(mocker: MockFixture) -> None:
+def test_upload_new(mocker: MockerFixture) -> None:
"""
Test file upload when the table does not exist.
"""
@@ -350,7 +350,7 @@ def test_upload_new(mocker: MockFixture) -> None:
)
-def test_upload_existing(mocker: MockFixture) -> None:
+def test_upload_existing(mocker: MockerFixture) -> None:
"""
Test file upload when the table does exist.
"""
@@ -409,7 +409,7 @@ def test_upload_existing(mocker: MockFixture) -> None:
)
-def test_get_url_for_impersonation_username(mocker: MockFixture) -> None:
+def test_get_url_for_impersonation_username(mocker: MockerFixture) -> None:
"""
Test passing a username to `get_url_for_impersonation`.
"""
@@ -444,7 +444,7 @@ def test_get_url_for_impersonation_access_token() -> None:
) == make_url("gsheets://?access_token=access-token")
-def test_is_oauth2_enabled_no_config(mocker: MockFixture) -> None:
+def test_is_oauth2_enabled_no_config(mocker: MockerFixture) -> None:
"""
Test `is_oauth2_enabled` when OAuth2 is not configured.
"""
@@ -458,7 +458,7 @@ def test_is_oauth2_enabled_no_config(mocker: MockFixture) -> None:
assert GSheetsEngineSpec.is_oauth2_enabled() is False
-def test_is_oauth2_enabled_config(mocker: MockFixture) -> None:
+def test_is_oauth2_enabled_config(mocker: MockerFixture) -> None:
"""
Test `is_oauth2_enabled` when OAuth2 is configured.
"""
@@ -501,7 +501,7 @@ def oauth2_config() -> OAuth2ClientConfig:
def test_get_oauth2_authorization_uri(
- mocker: MockFixture,
+ mocker: MockerFixture,
oauth2_config: OAuth2ClientConfig,
) -> None:
"""
@@ -532,7 +532,7 @@ def test_get_oauth2_authorization_uri(
def test_get_oauth2_token(
- mocker: MockFixture,
+ mocker: MockerFixture,
oauth2_config: OAuth2ClientConfig,
) -> None:
"""
@@ -570,7 +570,7 @@ def test_get_oauth2_token(
def test_get_oauth2_fresh_token(
- mocker: MockFixture,
+ mocker: MockerFixture,
oauth2_config: OAuth2ClientConfig,
) -> None:
"""
diff --git a/tests/unit_tests/db_engine_specs/test_init.py b/tests/unit_tests/db_engine_specs/test_init.py
index fc75694c08..fe7f330459 100644
--- a/tests/unit_tests/db_engine_specs/test_init.py
+++ b/tests/unit_tests/db_engine_specs/test_init.py
@@ -17,12 +17,12 @@
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset.db_engine_specs import get_available_engine_specs
-def test_get_available_engine_specs(mocker: MockFixture) -> None:
+def test_get_available_engine_specs(mocker: MockerFixture) -> None:
"""
get_available_engine_specs should return all engine specs
"""
@@ -55,7 +55,7 @@ def test_get_available_engine_specs(mocker: MockFixture) -> None:
[{"DBS_AVAILABLE_DENYLIST": {"databricks": {"pyhive", "pyodbc"}}}],
indirect=True,
)
-def test_get_available_engine_specs_with_denylist(mocker: MockFixture) -> None:
+def test_get_available_engine_specs_with_denylist(mocker: MockerFixture) -> None:
"""
The denylist removes items from the db engine spec list
"""
diff --git a/tests/unit_tests/db_engine_specs/test_postgres.py b/tests/unit_tests/db_engine_specs/test_postgres.py
index d955d3ce50..32b8bb6137 100644
--- a/tests/unit_tests/db_engine_specs/test_postgres.py
+++ b/tests/unit_tests/db_engine_specs/test_postgres.py
@@ -19,7 +19,7 @@ from datetime import datetime
from typing import Any, Optional
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy import types
from sqlalchemy.dialects.postgresql import DOUBLE_PRECISION, ENUM, JSON
from sqlalchemy.engine.url import make_url
@@ -149,7 +149,7 @@ def test_get_prequeries() -> None:
]
-def test_get_default_schema_for_query(mocker: MockFixture) -> None:
+def test_get_default_schema_for_query(mocker: MockerFixture) -> None:
"""
Test the ``get_default_schema_for_query`` method.
"""
diff --git a/tests/unit_tests/explore/utils_test.py b/tests/unit_tests/explore/utils_test.py
index 2b274106ca..813ef05b3f 100644
--- a/tests/unit_tests/explore/utils_test.py
+++ b/tests/unit_tests/explore/utils_test.py
@@ -16,7 +16,7 @@
# under the License.
from flask_appbuilder.security.sqla.models import User
from pytest import raises
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset.commands.chart.exceptions import (
ChartAccessDeniedError,
@@ -60,7 +60,7 @@ def test_unsaved_chart_no_dataset_id() -> None:
)
-def test_unsaved_chart_unknown_dataset_id(mocker: MockFixture) -> None:
+def test_unsaved_chart_unknown_dataset_id(mocker: MockerFixture) -> None:
from superset.explore.utils import check_access as check_chart_access
with raises(DatasetNotFoundError):
@@ -74,7 +74,7 @@ def test_unsaved_chart_unknown_dataset_id(mocker: MockFixture) -> None:
)
-def test_unsaved_chart_unknown_query_id(mocker: MockFixture) -> None:
+def test_unsaved_chart_unknown_query_id(mocker: MockerFixture) -> None:
from superset.explore.utils import check_access as check_chart_access
with raises(QueryNotFoundValidationError):
@@ -88,7 +88,7 @@ def test_unsaved_chart_unknown_query_id(mocker: MockFixture) -> None:
)
-def test_unsaved_chart_unauthorized_dataset(mocker: MockFixture) -> None:
+def test_unsaved_chart_unauthorized_dataset(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
@@ -104,7 +104,7 @@ def test_unsaved_chart_unauthorized_dataset(mocker: MockFixture) -> None:
)
-def test_unsaved_chart_authorized_dataset(mocker: MockFixture) -> None:
+def test_unsaved_chart_authorized_dataset(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
@@ -119,7 +119,7 @@ def test_unsaved_chart_authorized_dataset(mocker: MockFixture) -> None:
)
-def test_saved_chart_unknown_chart_id(mocker: MockFixture) -> None:
+def test_saved_chart_unknown_chart_id(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
@@ -136,7 +136,7 @@ def test_saved_chart_unknown_chart_id(mocker: MockFixture) -> None:
)
-def test_saved_chart_unauthorized_dataset(mocker: MockFixture) -> None:
+def test_saved_chart_unauthorized_dataset(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
@@ -152,7 +152,7 @@ def test_saved_chart_unauthorized_dataset(mocker: MockFixture) -> None:
)
-def test_saved_chart_is_admin(mocker: MockFixture) -> None:
+def test_saved_chart_is_admin(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
from superset.models.slice import Slice
@@ -170,7 +170,7 @@ def test_saved_chart_is_admin(mocker: MockFixture) -> None:
)
-def test_saved_chart_is_owner(mocker: MockFixture) -> None:
+def test_saved_chart_is_owner(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
from superset.models.slice import Slice
@@ -189,7 +189,7 @@ def test_saved_chart_is_owner(mocker: MockFixture) -> None:
)
-def test_saved_chart_has_access(mocker: MockFixture) -> None:
+def test_saved_chart_has_access(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
from superset.models.slice import Slice
@@ -209,7 +209,7 @@ def test_saved_chart_has_access(mocker: MockFixture) -> None:
)
-def test_saved_chart_no_access(mocker: MockFixture) -> None:
+def test_saved_chart_no_access(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_access as check_chart_access
from superset.models.slice import Slice
@@ -230,7 +230,7 @@ def test_saved_chart_no_access(mocker: MockFixture) -> None:
)
-def test_dataset_has_access(mocker: MockFixture) -> None:
+def test_dataset_has_access(mocker: MockerFixture) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_datasource_access
@@ -248,7 +248,7 @@ def test_dataset_has_access(mocker: MockFixture) -> None:
)
-def test_query_has_access(mocker: MockFixture) -> None:
+def test_query_has_access(mocker: MockerFixture) -> None:
from superset.explore.utils import check_datasource_access
from superset.models.sql_lab import Query
@@ -266,7 +266,7 @@ def test_query_has_access(mocker: MockFixture) -> None:
)
-def test_query_no_access(mocker: MockFixture, client) -> None:
+def test_query_no_access(mocker: MockerFixture, client) -> None:
from superset.connectors.sqla.models import SqlaTable
from superset.explore.utils import check_datasource_access
from superset.models.sql_lab import Query
diff --git a/tests/unit_tests/extensions/test_sqlalchemy.py b/tests/unit_tests/extensions/test_sqlalchemy.py
index 24c849f55a..e30651164f 100644
--- a/tests/unit_tests/extensions/test_sqlalchemy.py
+++ b/tests/unit_tests/extensions/test_sqlalchemy.py
@@ -21,7 +21,7 @@ from collections.abc import Iterator
from typing import TYPE_CHECKING
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.engine import create_engine
from sqlalchemy.exc import ProgrammingError
from sqlalchemy.orm.session import Session
@@ -105,7 +105,7 @@ def table2(session: Session, database2: "Database") -> Iterator[None]:
@with_feature_flags(ENABLE_SUPERSET_META_DB=True)
-def test_superset(mocker: MockFixture, app_context: None, table1: None) -> None:
+def test_superset(mocker: MockerFixture, app_context: None, table1: None) -> None:
"""
Simple test querying a table.
"""
@@ -118,7 +118,7 @@ def test_superset(mocker: MockFixture, app_context: None, table1: None) -> None:
@with_feature_flags(ENABLE_SUPERSET_META_DB=True)
-def test_superset_limit(mocker: MockFixture, app_context: None, table1: None) -> None:
+def test_superset_limit(mocker: MockerFixture, app_context: None, table1: None) -> None:
"""
Simple that limit is applied when querying a table.
"""
@@ -140,7 +140,7 @@ def test_superset_limit(mocker: MockFixture, app_context: None, table1: None) ->
@with_feature_flags(ENABLE_SUPERSET_META_DB=True)
def test_superset_joins(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
table1: None,
table2: None,
@@ -165,7 +165,7 @@ def test_superset_joins(
@with_feature_flags(ENABLE_SUPERSET_META_DB=True)
def test_dml(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
table1: None,
table2: None,
@@ -201,7 +201,7 @@ def test_dml(
@with_feature_flags(ENABLE_SUPERSET_META_DB=True)
-def test_security_manager(mocker: MockFixture, app_context: None, table1: None) -> None:
+def test_security_manager(mocker: MockerFixture, app_context: None, table1: None) -> None:
"""
Test that we use the security manager to check for permissions.
"""
@@ -232,7 +232,7 @@ def test_security_manager(mocker: MockFixture, app_context: None, table1: None)
@with_feature_flags(ENABLE_SUPERSET_META_DB=True)
-def test_allowed_dbs(mocker: MockFixture, app_context: None, table1: None) -> None:
+def test_allowed_dbs(mocker: MockerFixture, app_context: None, table1: None) -> None:
"""
Test that DBs can be restricted.
"""
diff --git a/tests/unit_tests/feature_flag_test.py b/tests/unit_tests/feature_flag_test.py
index 43d142e7f6..1cce8c69e3 100644
--- a/tests/unit_tests/feature_flag_test.py
+++ b/tests/unit_tests/feature_flag_test.py
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset import is_feature_enabled
@@ -23,7 +23,7 @@ def dummy_is_feature_enabled(feature_flag_name: str, default: bool = True) -> bo
return True if feature_flag_name.startswith("True_") else default
-def test_existing_feature_flags(mocker: MockFixture) -> None:
+def test_existing_feature_flags(mocker: MockerFixture) -> None:
"""
Test that ``is_feature_enabled`` reads flags correctly.
"""
@@ -35,7 +35,7 @@ def test_existing_feature_flags(mocker: MockFixture) -> None:
assert is_feature_enabled("FOO") is True
-def test_nonexistent_feature_flags(mocker: MockFixture) -> None:
+def test_nonexistent_feature_flags(mocker: MockerFixture) -> None:
"""
Test that ``is_feature_enabled`` returns ``False`` when flag not set.
"""
@@ -45,7 +45,7 @@ def test_nonexistent_feature_flags(mocker: MockFixture) -> None:
assert is_feature_enabled("FOO") is False
-def test_is_feature_enabled(mocker: MockFixture) -> None:
+def test_is_feature_enabled(mocker: MockerFixture) -> None:
"""
Test ``_is_feature_enabled_func``.
"""
diff --git a/tests/unit_tests/importexport/api_test.py b/tests/unit_tests/importexport/api_test.py
index f5443450ff..ffdc49ae21 100644
--- a/tests/unit_tests/importexport/api_test.py
+++ b/tests/unit_tests/importexport/api_test.py
@@ -22,14 +22,14 @@ from pathlib import Path
from typing import Any
from zipfile import is_zipfile, ZipFile
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset import security_manager
from superset.utils import json
def test_export_assets(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -69,7 +69,7 @@ def test_export_assets(
def test_import_assets(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -116,7 +116,7 @@ def test_import_assets(
def test_import_assets_not_zip(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -154,7 +154,7 @@ def test_import_assets_not_zip(
def test_import_assets_no_form_data(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -188,7 +188,7 @@ def test_import_assets_no_form_data(
def test_import_assets_incorrect_form_data(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
@@ -207,7 +207,7 @@ def test_import_assets_incorrect_form_data(
def test_import_assets_no_contents(
- mocker: MockFixture,
+ mocker: MockerFixture,
client: Any,
full_api_access: None,
) -> None:
diff --git a/tests/unit_tests/jinja_context_test.py b/tests/unit_tests/jinja_context_test.py
index b53b3537ea..53747b5f7d 100644
--- a/tests/unit_tests/jinja_context_test.py
+++ b/tests/unit_tests/jinja_context_test.py
@@ -19,7 +19,7 @@
from typing import Any
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.dialects import mysql
from sqlalchemy.dialects.postgresql import dialect
@@ -346,7 +346,7 @@ def test_safe_proxy_nested_lambda() -> None:
safe_proxy(func, {"foo": lambda: "bar"})
-def test_user_macros(mocker: MockFixture):
+def test_user_macros(mocker: MockerFixture):
"""
Test all user macros:
- ``current_user_id``
@@ -367,7 +367,7 @@ def test_user_macros(mocker: MockFixture):
assert mock_cache_key_wrapper.call_count == 3
-def test_user_macros_without_cache_key_inclusion(mocker: MockFixture):
+def test_user_macros_without_cache_key_inclusion(mocker: MockerFixture):
"""
Test all user macros with ``add_to_cache_keys`` set to ``False``.
"""
@@ -385,7 +385,7 @@ def test_user_macros_without_cache_key_inclusion(mocker: MockFixture):
assert mock_cache_key_wrapper.call_count == 0
-def test_user_macros_without_user_info(mocker: MockFixture):
+def test_user_macros_without_user_info(mocker: MockerFixture):
"""
Test all user macros when no user info is available.
"""
@@ -410,7 +410,7 @@ def test_where_in() -> None:
assert where_in(["O'Malley's"]) == "('O''Malley''s')"
-def test_dataset_macro(mocker: MockFixture) -> None:
+def test_dataset_macro(mocker: MockerFixture) -> None:
"""
Test the ``dataset_macro`` macro.
"""
@@ -526,7 +526,7 @@ GROUP BY
assert str(excinfo.value) == "Dataset 1 not found!"
-def test_dataset_macro_mutator_with_comments(mocker: MockFixture) -> None:
+def test_dataset_macro_mutator_with_comments(mocker: MockerFixture) -> None:
"""
Test ``dataset_macro`` when the mutator adds comment.
"""
@@ -549,7 +549,7 @@ SELECT 1
)
-def test_metric_macro_with_dataset_id(mocker: MockFixture) -> None:
+def test_metric_macro_with_dataset_id(mocker: MockerFixture) -> None:
"""
Test the ``metric_macro`` when passing a dataset ID.
"""
@@ -568,7 +568,7 @@ def test_metric_macro_with_dataset_id(mocker: MockFixture) -> None:
mock_get_form_data.assert_not_called()
-def test_metric_macro_with_dataset_id_invalid_key(mocker: MockFixture) -> None:
+def test_metric_macro_with_dataset_id_invalid_key(mocker: MockerFixture) -> None:
"""
Test the ``metric_macro`` when passing a dataset ID and an invalid key.
"""
@@ -589,7 +589,7 @@ def test_metric_macro_with_dataset_id_invalid_key(mocker: MockFixture) -> None:
mock_get_form_data.assert_not_called()
-def test_metric_macro_invalid_dataset_id(mocker: MockFixture) -> None:
+def test_metric_macro_invalid_dataset_id(mocker: MockerFixture) -> None:
"""
Test the ``metric_macro`` when specifying a dataset that doesn't exist.
"""
@@ -602,7 +602,7 @@ def test_metric_macro_invalid_dataset_id(mocker: MockFixture) -> None:
mock_get_form_data.assert_not_called()
-def test_metric_macro_no_dataset_id_no_context(mocker: MockFixture) -> None:
+def test_metric_macro_no_dataset_id_no_context(mocker: MockerFixture) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and it's
not available in the context.
@@ -620,7 +620,7 @@ def test_metric_macro_no_dataset_id_no_context(mocker: MockFixture) -> None:
def test_metric_macro_no_dataset_id_with_context_missing_info(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and request
@@ -644,7 +644,7 @@ def test_metric_macro_no_dataset_id_with_context_missing_info(
def test_metric_macro_no_dataset_id_with_context_datasource_id(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and it's
@@ -675,7 +675,7 @@ def test_metric_macro_no_dataset_id_with_context_datasource_id(
def test_metric_macro_no_dataset_id_with_context_datasource_id_none(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and it's
@@ -703,7 +703,7 @@ def test_metric_macro_no_dataset_id_with_context_datasource_id_none(
DatasetDAO.find_by_id.assert_not_called()
-def test_metric_macro_no_dataset_id_with_context_chart_id(mocker: MockFixture) -> None:
+def test_metric_macro_no_dataset_id_with_context_chart_id(mocker: MockerFixture) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and context
includes an existing chart ID (url_params.slice_id).
@@ -735,7 +735,7 @@ def test_metric_macro_no_dataset_id_with_context_chart_id(mocker: MockFixture) -
def test_metric_macro_no_dataset_id_with_context_slice_id_none(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and context
@@ -761,7 +761,7 @@ def test_metric_macro_no_dataset_id_with_context_slice_id_none(
DatasetDAO.find_by_id.assert_not_called()
-def test_metric_macro_no_dataset_id_with_context_chart(mocker: MockFixture) -> None:
+def test_metric_macro_no_dataset_id_with_context_chart(mocker: MockerFixture) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and context
includes an existing chart (get_form_data()[1]).
@@ -791,7 +791,7 @@ def test_metric_macro_no_dataset_id_with_context_chart(mocker: MockFixture) -> N
def test_metric_macro_no_dataset_id_with_context_deleted_chart(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and context
@@ -818,7 +818,7 @@ def test_metric_macro_no_dataset_id_with_context_deleted_chart(
def test_metric_macro_no_dataset_id_with_context_chart_no_datasource_id(
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
"""
Test the ``metric_macro`` when not specifying a dataset ID and context
diff --git a/tests/unit_tests/models/core_test.py b/tests/unit_tests/models/core_test.py
index c4d642baf5..e563971a5c 100644
--- a/tests/unit_tests/models/core_test.py
+++ b/tests/unit_tests/models/core_test.py
@@ -20,7 +20,7 @@
from datetime import datetime
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.engine.url import make_url
@@ -43,7 +43,7 @@ oauth2_client_info = {
}
-def test_get_metrics(mocker: MockFixture) -> None:
+def test_get_metrics(mocker: MockerFixture) -> None:
"""
Tests for ``get_metrics``.
"""
@@ -89,7 +89,7 @@ def test_get_metrics(mocker: MockFixture) -> None:
]
-def test_get_db_engine_spec(mocker: MockFixture) -> None:
+def test_get_db_engine_spec(mocker: MockerFixture) -> None:
"""
Tests for ``get_db_engine_spec``.
"""
@@ -228,7 +228,7 @@ def test_table_column_database() -> None:
assert TableColumn(database=database).database is database
-def test_get_prequeries(mocker: MockFixture) -> None:
+def test_get_prequeries(mocker: MockerFixture) -> None:
"""
Tests for ``get_prequeries``.
"""
@@ -272,7 +272,7 @@ def test_get_default_catalog() -> None:
assert database.get_default_catalog() == "examples"
-def test_get_default_schema(mocker: MockFixture) -> None:
+def test_get_default_schema(mocker: MockerFixture) -> None:
"""
Test the `get_default_schema` method.
"""
@@ -289,7 +289,7 @@ def test_get_default_schema(mocker: MockFixture) -> None:
get_inspector.assert_called_with(catalog="examples")
-def test_get_all_catalog_names(mocker: MockFixture) -> None:
+def test_get_all_catalog_names(mocker: MockerFixture) -> None:
"""
Test the `get_all_catalog_names` method.
"""
@@ -306,7 +306,7 @@ def test_get_all_catalog_names(mocker: MockFixture) -> None:
get_inspector.assert_called_with(ssh_tunnel=None)
-def test_get_sqla_engine(mocker: MockFixture) -> None:
+def test_get_sqla_engine(mocker: MockerFixture) -> None:
"""
Test `_get_sqla_engine`.
"""
@@ -334,7 +334,7 @@ def test_get_sqla_engine(mocker: MockFixture) -> None:
)
-def test_get_sqla_engine_user_impersonation(mocker: MockFixture) -> None:
+def test_get_sqla_engine_user_impersonation(mocker: MockerFixture) -> None:
"""
Test user impersonation in `_get_sqla_engine`.
"""
@@ -364,7 +364,7 @@ def test_get_sqla_engine_user_impersonation(mocker: MockFixture) -> None:
@with_feature_flags(IMPERSONATE_WITH_EMAIL_PREFIX=True)
-def test_get_sqla_engine_user_impersonation_email(mocker: MockFixture) -> None:
+def test_get_sqla_engine_user_impersonation_email(mocker: MockerFixture) -> None:
"""
Test user impersonation in `_get_sqla_engine` with `username_from_email`.
"""
@@ -430,7 +430,7 @@ def test_get_oauth2_config(app_context: None) -> None:
}
-def test_raw_connection_oauth(mocker: MockFixture) -> None:
+def test_raw_connection_oauth(mocker: MockerFixture) -> None:
"""
Test that we can start OAuth2 from `raw_connection()` errors.
diff --git a/tests/unit_tests/models/sql_lab_test.py b/tests/unit_tests/models/sql_lab_test.py
index a4c09d41c9..a2ce2a6afa 100644
--- a/tests/unit_tests/models/sql_lab_test.py
+++ b/tests/unit_tests/models/sql_lab_test.py
@@ -19,7 +19,7 @@ from unittest.mock import MagicMock
import pytest
from flask_appbuilder import Model
from jinja2.exceptions import TemplateError
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import SupersetSecurityException
@@ -49,7 +49,7 @@ from superset.models.sql_lab import Query, SavedQuery
def test_sql_tables_mixin_sql_tables_exception(
klass: type[Model],
exception: Exception,
- mocker: MockFixture,
+ mocker: MockerFixture,
) -> None:
mocker.patch(
"superset.models.sql_lab.extract_tables_from_jinja_sql",
diff --git a/tests/unit_tests/reports/schemas_test.py b/tests/unit_tests/reports/schemas_test.py
index 2cc18199e7..9a0e9d0c45 100644
--- a/tests/unit_tests/reports/schemas_test.py
+++ b/tests/unit_tests/reports/schemas_test.py
@@ -17,12 +17,12 @@
import pytest
from marshmallow import ValidationError
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset.reports.schemas import ReportSchedulePostSchema
-def test_report_post_schema_custom_width_validation(mocker: MockFixture) -> None:
+def test_report_post_schema_custom_width_validation(mocker: MockerFixture) -> None:
"""
Test the custom width validation.
"""
diff --git a/tests/unit_tests/security/manager_test.py b/tests/unit_tests/security/manager_test.py
index cf7587b11b..a0ec87c52e 100644
--- a/tests/unit_tests/security/manager_test.py
+++ b/tests/unit_tests/security/manager_test.py
@@ -19,7 +19,7 @@
import pytest
from flask_appbuilder.security.sqla.models import Role, User
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from superset.common.query_object import QueryObject
from superset.connectors.sqla.models import Database, SqlaTable
@@ -60,7 +60,7 @@ def stored_metrics() -> list[AdhocMetric]:
def test_raise_for_access_guest_user_ok(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
stored_metrics: list[AdhocMetric],
) -> None:
@@ -87,7 +87,7 @@ def test_raise_for_access_guest_user_ok(
def test_raise_for_access_guest_user_tampered_id(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
stored_metrics: list[AdhocMetric],
) -> None:
@@ -115,7 +115,7 @@ def test_raise_for_access_guest_user_tampered_id(
def test_raise_for_access_guest_user_tampered_form_data(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
stored_metrics: list[AdhocMetric],
) -> None:
@@ -152,7 +152,7 @@ def test_raise_for_access_guest_user_tampered_form_data(
def test_raise_for_access_guest_user_tampered_queries(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
stored_metrics: list[AdhocMetric],
) -> None:
@@ -190,7 +190,7 @@ def test_raise_for_access_guest_user_tampered_queries(
def test_raise_for_access_query_default_schema(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
) -> None:
"""
@@ -250,7 +250,7 @@ def test_raise_for_access_query_default_schema(
)
-def test_raise_for_access_jinja_sql(mocker: MockFixture, app_context: None) -> None:
+def test_raise_for_access_jinja_sql(mocker: MockerFixture, app_context: None) -> None:
"""
Test that Jinja gets rendered to SQL.
"""
@@ -286,7 +286,7 @@ def test_raise_for_access_jinja_sql(mocker: MockFixture, app_context: None) -> N
def test_raise_for_access_chart_for_datasource_permission(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
) -> None:
"""
@@ -422,7 +422,7 @@ def test_raise_for_access_chart_owner(
def test_query_context_modified(
- mocker: MockFixture,
+ mocker: MockerFixture,
stored_metrics: list[AdhocMetric],
) -> None:
"""
@@ -448,7 +448,7 @@ def test_query_context_modified(
def test_query_context_modified_tampered(
- mocker: MockFixture,
+ mocker: MockerFixture,
stored_metrics: list[AdhocMetric],
) -> None:
"""
@@ -483,7 +483,7 @@ def test_query_context_modified_tampered(
assert query_context_modified(query_context)
-def test_query_context_modified_native_filter(mocker: MockFixture) -> None:
+def test_query_context_modified_native_filter(mocker: MockerFixture) -> None:
"""
Test the `query_context_modified` function with a native filter request.
@@ -495,7 +495,7 @@ def test_query_context_modified_native_filter(mocker: MockFixture) -> None:
assert not query_context_modified(query_context)
-def test_query_context_modified_mixed_chart(mocker: MockFixture) -> None:
+def test_query_context_modified_mixed_chart(mocker: MockerFixture) -> None:
"""
Test the `query_context_modified` function for a mixed chart request.
@@ -564,7 +564,7 @@ def test_get_schema_perm() -> None:
def test_raise_for_access_catalog(
- mocker: MockFixture,
+ mocker: MockerFixture,
app_context: None,
) -> None:
"""
diff --git a/tests/unit_tests/tags/commands/create_test.py b/tests/unit_tests/tags/commands/create_test.py
index 2697e74aec..62ec9619a0 100644
--- a/tests/unit_tests/tags/commands/create_test.py
+++ b/tests/unit_tests/tags/commands/create_test.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset import db
@@ -67,7 +67,7 @@ def session_with_data(session: Session):
yield session
-def test_create_command_success(session_with_data: Session, mocker: MockFixture):
+def test_create_command_success(session_with_data: Session, mocker: MockerFixture):
from superset.commands.tag.create import CreateCustomTagWithRelationshipsCommand
from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
@@ -108,7 +108,7 @@ def test_create_command_success(session_with_data: Session, mocker: MockFixture)
)
-def test_create_command_success_clear(session_with_data: Session, mocker: MockFixture):
+def test_create_command_success_clear(session_with_data: Session, mocker: MockerFixture):
from superset.commands.tag.create import CreateCustomTagWithRelationshipsCommand
from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
diff --git a/tests/unit_tests/tags/commands/update_test.py b/tests/unit_tests/tags/commands/update_test.py
index d3786b2395..16bf9180fa 100644
--- a/tests/unit_tests/tags/commands/update_test.py
+++ b/tests/unit_tests/tags/commands/update_test.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import pytest
-from pytest_mock import MockFixture
+from pytest_mock import MockerFixture
from sqlalchemy.orm.session import Session
from superset import db
@@ -76,7 +76,7 @@ def session_with_data(session: Session):
yield session
-def test_update_command_success(session_with_data: Session, mocker: MockFixture):
+def test_update_command_success(session_with_data: Session, mocker: MockerFixture):
from superset.commands.tag.update import UpdateTagCommand
from superset.daos.tag import TagDAO
from superset.models.dashboard import Dashboard
@@ -111,7 +111,7 @@ def test_update_command_success(session_with_data: Session, mocker: MockFixture)
def test_update_command_success_duplicates(
- session_with_data: Session, mocker: MockFixture
+ session_with_data: Session, mocker: MockerFixture
):
from superset.commands.tag.create import CreateCustomTagWithRelationshipsCommand
from superset.commands.tag.update import UpdateTagCommand
@@ -161,7 +161,7 @@ def test_update_command_success_duplicates(
def test_update_command_failed_validation(
- session_with_data: Session, mocker: MockFixture
+ session_with_data: Session, mocker: MockerFixture
):
from superset.commands.tag.create import CreateCustomTagWithRelationshipsCommand
from superset.commands.tag.exceptions import TagInvalidError