diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51924b7..1636cc2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,17 +6,17 @@ repos: hooks: - id: double-quote-string-fixer - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 23.1.0 hooks: - 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 rev: 5.12.0 hooks: - id: isort args: ['--profile', 'black', '--line-length', '110'] - repo: https://github.com/asottile/pyupgrade - rev: v3.1.0 + rev: v3.3.1 hooks: - id: pyupgrade - args: ['--keep-percent-format', '--py37-plus'] + args: ['--keep-percent-format', '--py39-plus'] diff --git a/django_journal/migrations/0001_initial.py b/django_journal/migrations/0001_initial.py index 9a2f303..0fa6225 100644 --- a/django_journal/migrations/0001_initial.py +++ b/django_journal/migrations/0001_initial.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ] diff --git a/tests/test_main.py b/tests/test_main.py index f06e028..f4d815b 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,3 +1,4 @@ +import pytest from django.contrib.auth.models import Group, User from django.db import transaction from django.test import TestCase @@ -72,7 +73,8 @@ class JournalTestCase(TestCase): self.assertEqual(l[1]['user'], '') -def test_error_record(db): +@pytest.mark.django_db(databases=['default', 'error']) +def test_error_record(transactional_db): error_record('error', 'error message') journal = Journal.objects.first() assert journal.tag.name == 'error' @@ -83,7 +85,8 @@ def test_error_record(db): 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') journal = error_record('error', 'error message', someobj=tag) objdata = journal.objectdata_set.first() diff --git a/tox.ini b/tox.ini index 93ad7fe..41ac450 100644 --- a/tox.ini +++ b/tox.ini @@ -8,11 +8,12 @@ usedevelop = True deps = django22: django>=2.2,<2.3 django32: django>=3.2.12,<3.3 - psycopg2<2.9 + psycopg2-binary pytest-cov pytest - pytest-django<4.3 + pytest-django setenv = + PYTHONPATH=. DJANGO_SETTINGS_MODULE=test_settings coverage: COVERAGE=--cov-append --cov-report xml --cov-report html --cov=django_journal/ commands =