💚 ci: Fix lint and test job failures
Two CI fixes: - Test job: Add `--no-root` to `poetry install`. Poetry 2.x tries to install the current project as a package, which fails because this is a Django app with no `packages` config. `--no-root` installs only dependencies, which is what CI needs. - Lint job: Add `F405` to ruff's ignore list. Django settings files use `from .base import *` by convention, which triggers false positives for every symbol defined in the parent module. Ignoring F405 is the standard approach for Django projects. Also fixed all 11 remaining `lint` errors: - Removed unused imports (logging, django, AuthError, conf, ValidationError) - Removed unused variable assignments (`user`, `msg`, `ex`) - Replaced `== True` comparison with truthy check Assisted-by: Claude Opus 4.6 (1M context) Signed-off-by: Justin Wheeler <jwheel@fedoraproject.org>
This commit is contained in:
parent
c17fb59eb8
commit
28706cd176
7 changed files with 8 additions and 13 deletions
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
run: |
|
||||
pip install poetry
|
||||
poetry config virtualenvs.create false
|
||||
poetry install --without docs
|
||||
poetry install --without docs --no-root
|
||||
|
||||
- name: Run tests
|
||||
run: pytest
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import unittest
|
||||
|
||||
from jsonschema import ValidationError
|
||||
from .. import schema
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class TestSearchView(TestCase):
|
|||
response = self.client.get(self.url,{'q':msg.message})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertTrue('is_paginated' in response.context)
|
||||
self.assertTrue(response.context['is_paginated'] == True)
|
||||
self.assertTrue(response.context['is_paginated'])
|
||||
self.assertTrue(len(response.context['object_list']) == 10)
|
||||
|
||||
def test_named_message_indexed(self):
|
||||
|
|
@ -72,17 +72,17 @@ class TestMessageCounter(TestCase):
|
|||
url = reverse('messaging:start')
|
||||
|
||||
def test_message_sent_included(self):
|
||||
msg = MessageModelFactory(status="sent")
|
||||
MessageModelFactory(status="sent")
|
||||
response = self.client.get(self.url)
|
||||
self.assertEqual(response.context['packets_sent'],1)
|
||||
|
||||
def test_message_read_included(self):
|
||||
msg = MessageModelFactory(status="read")
|
||||
MessageModelFactory(status="read")
|
||||
response = self.client.get(self.url)
|
||||
self.assertEqual(response.context['packets_sent'],1)
|
||||
|
||||
def test_message_to_be_confirmed_excluded(self):
|
||||
msg = MessageModelFactory(status="pending_sender_confirmation")
|
||||
MessageModelFactory(status="pending_sender_confirmation")
|
||||
response = self.client.get(self.url)
|
||||
self.assertEqual(response.context['packets_sent'],0)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,13 +21,12 @@ from .forms import MessageSendForm, MessageRecipientForm, MessageSenderPermissio
|
|||
from .models import Message, BLACKLIST_HMAC_SALT, BlacklistedEmail, strip_email
|
||||
|
||||
from fedora_messaging.api import publish
|
||||
from fedora_messaging.config import conf
|
||||
from fedora_messaging.exceptions import PublishReturned, ConnectionException
|
||||
from happinesspacket_schema.schema import MessageV1
|
||||
|
||||
#Include python-fedora
|
||||
from fedora.client.fas2 import AccountSystem
|
||||
from fedora.client import AuthError, AppError
|
||||
from fedora.client import AppError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -52,7 +51,6 @@ class StartView(ArchiveListView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(StartView, self).get_context_data(**kwargs)
|
||||
user = self.request.user
|
||||
return context
|
||||
|
||||
|
||||
|
|
@ -271,7 +269,7 @@ class FasidSearchView():
|
|||
request.session['recipient_email'] = person['email']
|
||||
return JsonResponse(user)
|
||||
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
response = JsonResponse({'error': 'Internal Server Error'})
|
||||
response.status_code = 500
|
||||
return response
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
import logging
|
||||
|
||||
from email.mime.image import MIMEImage
|
||||
from django.conf import settings
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import django
|
||||
from django.conf import settings
|
||||
from django.urls import include, re_path, path
|
||||
from django.conf.urls.static import static
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ addopts = [
|
|||
exclude = ["happinesspackets/*/migrations/*"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
ignore = ["E501"]
|
||||
ignore = ["E501", "F405"]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue