mirror of
https://github.com/apache/superset.git
synced 2026-04-24 10:35:01 +00:00
chore: set up ruff as a new linter/formatter (#28158)
This commit is contained in:
committed by
GitHub
parent
e8a678b75a
commit
2d63722150
@@ -16,6 +16,7 @@
|
||||
# under the License.
|
||||
# isort:skip_file
|
||||
"""Unit tests for Superset"""
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import random
|
||||
@@ -25,15 +26,15 @@ import io
|
||||
|
||||
import pytest
|
||||
import prison
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.sql import func # noqa: F401
|
||||
from unittest import mock
|
||||
|
||||
from flask_appbuilder.security.sqla.models import Role
|
||||
from tests.integration_tests.test_app import app
|
||||
from superset import db, sql_lab
|
||||
from superset.common.db_query_status import QueryStatus
|
||||
from superset.models.core import Database
|
||||
from superset.utils.database import get_example_database, get_main_database
|
||||
from superset.models.core import Database # noqa: F401
|
||||
from superset.utils.database import get_example_database, get_main_database # noqa: F401
|
||||
from superset.utils import core as utils
|
||||
from superset.models.sql_lab import Query
|
||||
|
||||
@@ -42,8 +43,8 @@ from tests.integration_tests.constants import (
|
||||
ADMIN_USERNAME,
|
||||
GAMMA_SQLLAB_NO_DATA_USERNAME,
|
||||
)
|
||||
from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_data
|
||||
from tests.integration_tests.fixtures.users import create_gamma_sqllab_no_data
|
||||
from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_data # noqa: F401
|
||||
from tests.integration_tests.fixtures.users import create_gamma_sqllab_no_data # noqa: F401
|
||||
|
||||
QUERIES_FIXTURE_COUNT = 10
|
||||
|
||||
@@ -65,7 +66,7 @@ class TestSqlLabApi(SupersetTestCase):
|
||||
assert resp.status_code == 200
|
||||
data = json.loads(resp.data.decode("utf-8"))
|
||||
result = data.get("result")
|
||||
assert result["active_tab"] == None
|
||||
assert result["active_tab"] is None # noqa: E711
|
||||
assert result["tab_state_ids"] == []
|
||||
self.assertEqual(len(result["databases"]), 0)
|
||||
|
||||
@@ -94,7 +95,7 @@ class TestSqlLabApi(SupersetTestCase):
|
||||
assert resp.status_code == 200
|
||||
data = json.loads(resp.data.decode("utf-8"))
|
||||
result = data.get("result")
|
||||
assert result["active_tab"] == None
|
||||
assert result["active_tab"] is None # noqa: E711
|
||||
assert result["tab_state_ids"] == []
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_data")
|
||||
@@ -195,7 +196,7 @@ class TestSqlLabApi(SupersetTestCase):
|
||||
"unauth_user1",
|
||||
"password",
|
||||
"Dummy Role",
|
||||
email=f"unauth_user1@superset.org",
|
||||
email="unauth_user1@superset.org", # noqa: F541
|
||||
)
|
||||
self.login(username="unauth_user1", password="password")
|
||||
rv = self.client.get("/api/v1/sqllab/")
|
||||
|
||||
Reference in New Issue
Block a user