From 0f750dc7c8db439b70e006563b16ebcef3d7b6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 5 Aug 2023 10:50:12 +0200 Subject: [PATCH] trivial: apply pre-commit rules --- bidon/settings.py | 5 +++-- bidon/urls.py | 5 ++--- bidon/wsgi.py | 2 +- debian/control | 17 ++++++++--------- manage.py | 4 ++-- setup.py | 10 +++++----- tests/settings.py | 4 ++-- tests/test_basic.py | 1 + 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bidon/settings.py b/bidon/settings.py index 66f4771..9c5a663 100644 --- a/bidon/settings.py +++ b/bidon/settings.py @@ -37,7 +37,7 @@ INSTALLED_APPS = ( 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'bidon.bidon_app' + 'bidon.bidon_app', ) MIDDLEWARE_CLASSES = ( @@ -104,7 +104,8 @@ STATIC_URL = '/static/' local_settings_file = os.environ.get( - 'BIDON_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')) + 'BIDON_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py') +) if os.path.exists(local_settings_file): with open(local_settings_file) as f: diff --git a/bidon/urls.py b/bidon/urls.py index 385fcec..d55ffc1 100644 --- a/bidon/urls.py +++ b/bidon/urls.py @@ -12,10 +12,9 @@ Class-based views Including another URLconf 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import include, url from django.contrib import admin - +from django.urls import include, path urlpatterns = [ - url(r'^admin/', include(admin.site.urls)), + path('admin/', include(admin.site.urls)), ] diff --git a/bidon/wsgi.py b/bidon/wsgi.py index 80e4de1..cf7ab1b 100644 --- a/bidon/wsgi.py +++ b/bidon/wsgi.py @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bidon.settings") +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bidon.settings') application = get_wsgi_application() diff --git a/debian/control b/debian/control index c0bef14..c8733c9 100644 --- a/debian/control +++ b/debian/control @@ -3,18 +3,17 @@ Section: python Priority: optional Maintainer: Emmanuel Cazenave Build-Depends: debhelper-compat (= 12), - python3-django, - python3-setuptools, - python3-all, - dh-python + dh-python, + python3-all, + python3-django, + python3-setuptools, Standards-Version: 3.9.6 Homepage: https://dev.entrouvert.org/projects/bidon Package: python-eo-bidon Architecture: all -Depends: ${python:Depends}, - ${misc:Depends}, - python3-django (>= 1:1.11), - python3-setuptools, +Depends: python3-django (>= 1:1.11), + python3-setuptools, + ${misc:Depends}, + ${python:Depends}, Description: Entr'ouvert sandox package (python module) - diff --git a/manage.py b/manage.py index 10f16bf..ecec29d 100755 --- a/manage.py +++ b/manage.py @@ -2,8 +2,8 @@ import os import sys -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bidon.settings") +if __name__ == '__main__': + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bidon.settings') from django.core.management import execute_from_command_line diff --git a/setup.py b/setup.py index cde0783..437fec4 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,13 @@ #! /usr/bin/env python -# -*- coding: utf-8 -*- import os import subprocess - -from setuptools.command.install_lib import install_lib as _install_lib +from distutils.cmd import Command from distutils.command.build import build as _build from distutils.command.sdist import sdist -from distutils.cmd import Command -from setuptools import setup, find_packages + +from setuptools import find_packages, setup +from setuptools.command.install_lib import install_lib as _install_lib class eo_sdist(sdist): @@ -63,6 +62,7 @@ class compile_translations(Command): def run(self): from django.core.management import call_command + os.environ.pop('DJANGO_SETTINGS_MODULE', None) for path, dirs, files in os.walk('bidon'): if 'locale' not in dirs: diff --git a/tests/settings.py b/tests/settings.py index e61ce92..78b30b0 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -2,9 +2,9 @@ import os DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'ENGINE': 'django.db.backends.postgresql', 'TEST': { - 'NAME': 'bidon-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:63], + 'NAME': 'bidon-test-%s' % os.environ.get('BRANCH_NAME', '').replace('/', '-')[:63], }, } } diff --git a/tests/test_basic.py b/tests/test_basic.py index 264d733..d506f44 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1,5 +1,6 @@ def test_true(db): assert True + def test_notfail(): assert True