From aa2505b1c4c0ce290952095d6d6cb0b1bb875643 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 10:54:01 +0000 Subject: [PATCH] ci: auto fixes from pre-commit hooks for more information, see https://pre-commit.ci --- .../migrations/0009_alter_snippetptr_cmsplugin_ptr.py | 1 - tests/requirements/dj32_cms40.txt | 2 +- tests/test_admin.py | 7 +++---- tests/test_config.py | 3 +-- tests/test_forms.py | 3 +-- tests/test_migrations.py | 3 +-- tests/test_plugins.py | 2 +- tests/test_templatetags.py | 3 +-- tests/utils/factories.py | 9 +++------ tests/utils/models.py | 4 +--- 10 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/djangocms_snippet/migrations/0009_alter_snippetptr_cmsplugin_ptr.py b/src/djangocms_snippet/migrations/0009_alter_snippetptr_cmsplugin_ptr.py index cf714456..8af01f53 100644 --- a/src/djangocms_snippet/migrations/0009_alter_snippetptr_cmsplugin_ptr.py +++ b/src/djangocms_snippet/migrations/0009_alter_snippetptr_cmsplugin_ptr.py @@ -18,4 +18,3 @@ class Migration(migrations.Migration): field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'), ), ] - diff --git a/tests/requirements/dj32_cms40.txt b/tests/requirements/dj32_cms40.txt index 3408845a..3255b63e 100644 --- a/tests/requirements/dj32_cms40.txt +++ b/tests/requirements/dj32_cms40.txt @@ -4,4 +4,4 @@ Django>=3.2,<4.0 # Unreleased django 3.2 & django-cms 4.0.x compatible packages https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms -https://github.com/django-cms/djangocms-versioning/tarball/1.2.2#egg=djangocms-versioning \ No newline at end of file +https://github.com/django-cms/djangocms-versioning/tarball/1.2.2#egg=djangocms-versioning diff --git a/tests/test_admin.py b/tests/test_admin.py index 85c98170..f74c6077 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -1,15 +1,14 @@ from importlib import reload from unittest import skipIf +from cms import __version__ as cms_version +from cms.test_utils.testcases import CMSTestCase +from cms.utils import get_current_site from django.contrib import admin from django.contrib.sites.models import Site from django.shortcuts import reverse from django.test import RequestFactory, override_settings -from cms import __version__ as cms_version -from cms.test_utils.testcases import CMSTestCase -from cms.utils import get_current_site - try: from djangocms_versioning.models import Version except ImportError: diff --git a/tests/test_config.py b/tests/test_config.py index 07ce7340..fa5fed36 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,9 +1,8 @@ from unittest import skipIf -from django.apps import apps - from cms import __version__ as cms_version from cms.test_utils.testcases import CMSTestCase +from django.apps import apps from djangocms_snippet.models import Snippet, SnippetGrouper diff --git a/tests/test_forms.py b/tests/test_forms.py index 4559449d..3d8092ce 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -1,10 +1,9 @@ from importlib import reload from unittest import skipIf -from django.test import override_settings - from cms import __version__ as cms_version from cms.test_utils.testcases import CMSTestCase +from django.test import override_settings from djangocms_snippet import forms from djangocms_snippet.forms import SnippetPluginForm diff --git a/tests/test_migrations.py b/tests/test_migrations.py index d9776982..f4fb90b0 100644 --- a/tests/test_migrations.py +++ b/tests/test_migrations.py @@ -3,11 +3,10 @@ from io import StringIO from unittest import skipIf +from cms import __version__ as cms_version from django.core.management import call_command from django.test import TestCase, override_settings -from cms import __version__ as cms_version - class MigrationTestCase(TestCase): diff --git a/tests/test_plugins.py b/tests/test_plugins.py index ef07946e..118dee01 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -2,9 +2,9 @@ from unittest import skipIf from cms import __version__ as cms_version - from cms.api import add_plugin, create_page from cms.test_utils.testcases import CMSTestCase + try: from djangocms_versioning.models import Version except ImportError: diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index 41fbbfc9..21e07e25 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -1,9 +1,8 @@ +from cms.test_utils.testcases import CMSTestCase from django.core.exceptions import ObjectDoesNotExist from django.template import Context, Template from django.template.exceptions import TemplateSyntaxError -from cms.test_utils.testcases import CMSTestCase - from .utils.factories import SnippetPluginFactory, SnippetWithVersionFactory diff --git a/tests/utils/factories.py b/tests/utils/factories.py index 6e2ffcfa..6ac47fe4 100644 --- a/tests/utils/factories.py +++ b/tests/utils/factories.py @@ -1,17 +1,14 @@ import string +import factory +from cms.models import Placeholder from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType - -from cms.models import Placeholder - -import factory from django.db import models from factory.fuzzy import FuzzyInteger, FuzzyText from djangocms_snippet.models import Snippet, SnippetGrouper, SnippetPtr - try: from djangocms_versioning.models import Version except ImportError: @@ -23,7 +20,7 @@ class UserFactory(factory.django.DjangoModelFactory): first_name = factory.Faker("first_name") last_name = factory.Faker("last_name") email = factory.LazyAttribute( - lambda u: "%s.%s@example.com" % (u.first_name.lower(), u.last_name.lower()) + lambda u: f"{u.first_name.lower()}.{u.last_name.lower()}@example.com" ) class Meta: diff --git a/tests/utils/models.py b/tests/utils/models.py index 8ebb1a58..9c3a92fa 100644 --- a/tests/utils/models.py +++ b/tests/utils/models.py @@ -1,9 +1,7 @@ +from cms import __version__ as cms_version from django.conf import settings from django.db import models -from cms import __version__ as cms_version - - if cms_version < "4": class Version(models.Model): content = models.ForeignKey("djangocms_snippet.Snippet", related_name="versions", on_delete=models.CASCADE)