chore: s/MockFixture/MockerFixture/g (#29160)

This commit is contained in:
Beto Dealmeida
2024-06-10 12:35:07 -04:00
committed by GitHub
parent bfae2c8348
commit 8e15d4807f
32 changed files with 235 additions and 213 deletions

View File

@@ -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:

View File

@@ -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,9 @@ 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 +170,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

View File

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

View File

@@ -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,9 @@ 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 +166,9 @@ 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(