chore: set up ruff as a new linter/formatter (#28158)

This commit is contained in:
Maxime Beauchemin
2024-04-24 17:19:53 -07:00
committed by GitHub
parent e8a678b75a
commit 2d63722150
579 changed files with 2508 additions and 2542 deletions

View File

@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
"""Unit tests for Superset"""
import datetime
import doctest
import html
@@ -56,16 +57,16 @@ from superset.views.database.views import DatabaseView
from tests.integration_tests.conftest import with_feature_flags
from tests.integration_tests.constants import ADMIN_USERNAME, GAMMA_USERNAME
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices,
load_birth_names_data,
load_birth_names_dashboard_with_slices, # noqa: F401
load_birth_names_data, # noqa: F401
)
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_data,
load_energy_table_with_slice,
load_energy_table_data, # noqa: F401
load_energy_table_with_slice, # noqa: F401
)
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices,
load_world_bank_data,
load_world_bank_dashboard_with_slices, # noqa: F401
load_world_bank_data, # noqa: F401
)
from tests.integration_tests.test_app import app
@@ -97,8 +98,8 @@ class TestCore(SupersetTestCase):
def insert_dashboard_created_by(self, username: str) -> Dashboard:
user = self.get_user(username)
dashboard = self.insert_dashboard(
f"create_title_test",
f"create_slug_test",
f"create_title_test", # noqa: F541
f"create_slug_test", # noqa: F541
[user.id],
created_by=user,
)
@@ -176,7 +177,7 @@ class TestCore(SupersetTestCase):
@pytest.mark.usefixtures("load_energy_table_with_slice")
def test_save_slice(self):
self.login(ADMIN_USERNAME)
slice_name = f"Energy Sankey"
slice_name = f"Energy Sankey" # noqa: F541
slice_id = self.get_slice(slice_name).id
copy_name_prefix = "Test Sankey"
copy_name = f"{copy_name_prefix}[save]{random.random()}"
@@ -478,7 +479,7 @@ class TestCore(SupersetTestCase):
def create_sample_csvfile(self, filename: str, content: list[str]) -> None:
with open(filename, "w+") as test_file:
for l in content:
for l in content: # noqa: E741
test_file.write(f"{l}\n")
def create_sample_excelfile(self, filename: str, content: dict[str, str]) -> None:
@@ -1185,7 +1186,7 @@ class TestCore(SupersetTestCase):
self.login(ADMIN_USERNAME)
random_key = "random_key"
mock_command.return_value = random_key
slice_name = f"Energy Sankey"
slice_name = f"Energy Sankey" # noqa: F541
slice_id = self.get_slice(slice_name).id
form_data = {"slice_id": slice_id, "viz_type": "line", "datasource": "1__table"}
rv = self.client.get(