comaptibility with python 3.11 (#86369)
gitea/django-journal/pipeline/head This commit looks good Details

This commit is contained in:
Benjamin Dauvergne 2024-01-31 12:11:37 +01:00
parent cfeae7afbe
commit c38f63e80b
4 changed files with 12 additions and 9 deletions

View File

@ -6,17 +6,17 @@ repos:
hooks: hooks:
- id: double-quote-string-fixer - id: double-quote-string-fixer
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 20.8b1 rev: 23.1.0
hooks: hooks:
- id: black - id: black
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] args: ['--target-version', 'py39', '--skip-string-normalization', '--line-length', '110']
- repo: https://github.com/PyCQA/isort - repo: https://github.com/PyCQA/isort
rev: 5.12.0 rev: 5.12.0
hooks: hooks:
- id: isort - id: isort
args: ['--profile', 'black', '--line-length', '110'] args: ['--profile', 'black', '--line-length', '110']
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v3.1.0 rev: v3.3.1
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: ['--keep-percent-format', '--py37-plus'] args: ['--keep-percent-format', '--py39-plus']

View File

@ -3,7 +3,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('contenttypes', '0002_remove_content_type_name'), ('contenttypes', '0002_remove_content_type_name'),
] ]

View File

@ -1,3 +1,4 @@
import pytest
from django.contrib.auth.models import Group, User from django.contrib.auth.models import Group, User
from django.db import transaction from django.db import transaction
from django.test import TestCase from django.test import TestCase
@ -72,7 +73,8 @@ class JournalTestCase(TestCase):
self.assertEqual(l[1]['user'], '<deleted>') self.assertEqual(l[1]['user'], '<deleted>')
def test_error_record(db): @pytest.mark.django_db(databases=['default', 'error'])
def test_error_record(transactional_db):
error_record('error', 'error message') error_record('error', 'error message')
journal = Journal.objects.first() journal = Journal.objects.first()
assert journal.tag.name == 'error' assert journal.tag.name == 'error'
@ -83,7 +85,8 @@ def test_error_record(db):
assert Journal.objects.count() == 2 assert Journal.objects.count() == 2
def test_error_record_with_db_obj(db): @pytest.mark.django_db(databases=['default', 'error'])
def test_error_record_with_db_obj(transactional_db):
tag = Tag.objects.create(name='some-tag') tag = Tag.objects.create(name='some-tag')
journal = error_record('error', 'error message', someobj=tag) journal = error_record('error', 'error message', someobj=tag)
objdata = journal.objectdata_set.first() objdata = journal.objectdata_set.first()

View File

@ -8,11 +8,12 @@ usedevelop = True
deps = deps =
django22: django>=2.2,<2.3 django22: django>=2.2,<2.3
django32: django>=3.2.12,<3.3 django32: django>=3.2.12,<3.3
psycopg2<2.9 psycopg2-binary
pytest-cov pytest-cov
pytest pytest
pytest-django<4.3 pytest-django
setenv = setenv =
PYTHONPATH=.
DJANGO_SETTINGS_MODULE=test_settings DJANGO_SETTINGS_MODULE=test_settings
coverage: COVERAGE=--cov-append --cov-report xml --cov-report html --cov=django_journal/ coverage: COVERAGE=--cov-append --cov-report xml --cov-report html --cov=django_journal/
commands = commands =