fix(lint): resolve ruff errors in tests and run_tests.py

- Fix import sorting (I001)
- Remove unused imports and variables (F401, F841)
- Add noqa for test code (S106 hardcoded passwords, S314 XML parsing)
- Auto-format with ruff format
This commit is contained in:
2026-02-02 12:44:37 +01:00
parent 97a7764155
commit 3f222a9141
12 changed files with 87 additions and 70 deletions

View File

@@ -71,6 +71,7 @@ class BulkOperationsIntegrationTest(TestCase):
def test_bulk_create_chunked(self):
"""Тест массового создания чанками."""
# Создаём тестовый сервис с BulkOperationsMixin
class TestService(BulkOperationsMixin):
model = BackgroundJob
@@ -88,10 +89,13 @@ class BulkOperationsIntegrationTest(TestCase):
self.assertEqual(count, 10)
# Проверяем что все созданы
self.assertEqual(BackgroundJob.objects.filter(task_name="test.bulk.task").count(), 10)
self.assertEqual(
BackgroundJob.objects.filter(task_name="test.bulk.task").count(), 10
)
def test_bulk_delete(self):
"""Тест массового удаления."""
class TestService(BulkOperationsMixin):
model = BackgroundJob
@@ -109,10 +113,13 @@ class BulkOperationsIntegrationTest(TestCase):
deleted = TestService.bulk_delete(ids_to_delete)
self.assertEqual(deleted, 3)
self.assertEqual(BackgroundJob.objects.filter(task_name="test.delete.task").count(), 2)
self.assertEqual(
BackgroundJob.objects.filter(task_name="test.delete.task").count(), 2
)
def test_bulk_update_fields(self):
"""Тест массового обновления полей."""
class TestService(BulkOperationsMixin):
model = BackgroundJob
@@ -138,6 +145,7 @@ class BulkOperationsIntegrationTest(TestCase):
def test_bulk_update_or_create_creates(self):
"""Тест upsert - создание новых."""
class TestService(BulkOperationsMixin):
model = BackgroundJob
@@ -157,6 +165,7 @@ class BulkOperationsIntegrationTest(TestCase):
def test_bulk_update_or_create_updates(self):
"""Тест upsert - обновление существующих."""
class TestService(BulkOperationsMixin):
model = BackgroundJob