From 3f44fceb4f4977543247a9e89a34b05af8ba4d1c Mon Sep 17 00:00:00 2001 From: Duncan Brown Date: Mon, 29 Jul 2024 21:07:25 +0100 Subject: [PATCH] Formatting --- .../consultations/jobs/upload_consultation.py | 4 ++-- consultation_analyser/consultations/views/consultations.py | 5 +++-- consultation_analyser/settings/local.py | 2 +- consultation_analyser/settings/test.py | 7 +++---- tests/integration/test_user_uploads_consultation.py | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/consultation_analyser/consultations/jobs/upload_consultation.py b/consultation_analyser/consultations/jobs/upload_consultation.py index f51f0a5d..9dbc8231 100644 --- a/consultation_analyser/consultations/jobs/upload_consultation.py +++ b/consultation_analyser/consultations/jobs/upload_consultation.py @@ -1,8 +1,8 @@ -from django_rq import job from django.core.files.storage import default_storage as storage +from django_rq import job -from consultation_analyser.consultations.upload_consultation import upload_consultation from consultation_analyser.authentication.models import User +from consultation_analyser.consultations.upload_consultation import upload_consultation @job("default") diff --git a/consultation_analyser/consultations/views/consultations.py b/consultation_analyser/consultations/views/consultations.py index a44b492a..ce775acb 100644 --- a/consultation_analyser/consultations/views/consultations.py +++ b/consultation_analyser/consultations/views/consultations.py @@ -1,5 +1,4 @@ import logging -import time from typing import Optional from django.contrib import messages @@ -61,7 +60,9 @@ def new(request: HttpRequest): form = ConsultationUploadForm(request.POST, request.FILES) if form.is_valid(): logger.info("Enqueueing upload_consultation job") - file_path = storage.save(request.FILES["consultation_json"].name, request.FILES["consultation_json"]) + file_path = storage.save( + request.FILES["consultation_json"].name, request.FILES["consultation_json"] + ) async_upload_consultation.delay(file_path, request.user.id) return render(request, "consultations/consultations/uploaded.html", {}) diff --git a/consultation_analyser/settings/local.py b/consultation_analyser/settings/local.py index fa94a4e7..3b3ecf0f 100644 --- a/consultation_analyser/settings/local.py +++ b/consultation_analyser/settings/local.py @@ -3,7 +3,7 @@ INSTALLED_APPS.append("django_extensions") # noqa F405 -STORAGES["default"] = { # noqa +STORAGES["default"] = { # noqa "BACKEND": "django.core.files.storage.FileSystemStorage", "OPTIONS": { "location": BASE_DIR / "tmp" # noqa diff --git a/consultation_analyser/settings/test.py b/consultation_analyser/settings/test.py index 22df05d9..28699357 100644 --- a/consultation_analyser/settings/test.py +++ b/consultation_analyser/settings/test.py @@ -1,9 +1,8 @@ import os from pathlib import Path -from django.conf.global_settings import STORAGES - import environ +from django.conf.global_settings import STORAGES BASE_DIR = Path(__file__).resolve().parent.parent.parent @@ -17,5 +16,5 @@ } # process all async jobs inline -for queueConfig in RQ_QUEUES.values(): # noqa - queueConfig['ASYNC'] = False +for queueConfig in RQ_QUEUES.values(): # noqa + queueConfig["ASYNC"] = "False" diff --git a/tests/integration/test_user_uploads_consultation.py b/tests/integration/test_user_uploads_consultation.py index 2e0be241..3922f226 100644 --- a/tests/integration/test_user_uploads_consultation.py +++ b/tests/integration/test_user_uploads_consultation.py @@ -1,6 +1,5 @@ import pytest from django.conf import settings -from django_rq import get_worker from webtest import Upload from consultation_analyser.factories import ProcessingRunFactory, UserFactory