mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: enforce more ruff rules (#31447)
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9da65d6bfd
commit
e51b95ffa8
@@ -20,7 +20,7 @@ import importlib
|
||||
import os
|
||||
import unittest.mock
|
||||
from collections.abc import Iterator
|
||||
from typing import Any, Callable
|
||||
from typing import Any, Callable, Union
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
@@ -46,7 +46,7 @@ def get_session(mocker: MockerFixture) -> Callable[[], Session]:
|
||||
engine = create_engine("sqlite://")
|
||||
|
||||
def get_session():
|
||||
Session_ = sessionmaker(bind=engine) # pylint: disable=invalid-name
|
||||
Session_ = sessionmaker(bind=engine) # pylint: disable=invalid-name # noqa: N806
|
||||
in_memory_session = Session_()
|
||||
|
||||
# flask calls db.session.remove()
|
||||
@@ -70,7 +70,7 @@ def get_session(mocker: MockerFixture) -> Callable[[], Session]:
|
||||
|
||||
@pytest.fixture
|
||||
def session(get_session) -> Iterator[Session]:
|
||||
yield get_session()
|
||||
return get_session()
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@@ -122,7 +122,7 @@ def app(request: SubRequest) -> Iterator[SupersetApp]:
|
||||
|
||||
importlib.reload(superset.views.base)
|
||||
|
||||
yield app
|
||||
return app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -141,7 +141,7 @@ def app_context(app: SupersetApp) -> Iterator[None]:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def full_api_access(mocker: MockerFixture) -> Iterator[None]:
|
||||
def full_api_access(mocker: MockerFixture) -> Union[Iterator[None], None]:
|
||||
"""
|
||||
Allow full access to the API.
|
||||
|
||||
@@ -156,7 +156,7 @@ def full_api_access(mocker: MockerFixture) -> Iterator[None]:
|
||||
mocker.patch.object(security_manager, "has_access", return_value=True)
|
||||
mocker.patch.object(security_manager, "can_access_all_databases", return_value=True)
|
||||
|
||||
yield
|
||||
return None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -174,7 +174,7 @@ def dummy_query_object(request, app_context):
|
||||
else:
|
||||
result_type = result_type_marker.args[0]
|
||||
|
||||
yield QueryObjectFactory(
|
||||
return QueryObjectFactory(
|
||||
app_configurations={
|
||||
"ROW_LIMIT": 100,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user