Skip to content

Commit 5ff1bac

Browse files
ci: pre-commit autoupdate (#144)
* ci: pre-commit autoupdate updates: - [github.com/asottile/pyupgrade: v3.4.0 → v3.15.0](asottile/pyupgrade@v3.4.0...v3.15.0) - [github.com/adamchainz/django-upgrade: 1.13.0 → 1.15.0](adamchainz/django-upgrade@1.13.0...1.15.0) - https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.270 → v0.1.4](astral-sh/ruff-pre-commit@v0.0.270...v0.1.4) - [github.com/astral-sh/ruff-pre-commit: v0.1.2 → v0.1.4](astral-sh/ruff-pre-commit@v0.1.2...v0.1.4) - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0) * ci: auto fixes from pre-commit hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 916e126 commit 5ff1bac

File tree

8 files changed

+76
-65
lines changed

8 files changed

+76
-65
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ Use 'x' to check each item: [x] I have ...
2626
* [ ] I have opened this pull request against ``master``
2727
* [ ] I have added or modified the tests when changing logic
2828
* [ ] I have followed [the conventional commits guidelines](https://www.conventionalcommits.org/) to add meaningful information into the changelog
29-
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
29+
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
3030
[Slack](https://www.django-cms.org/slack) to find a “pr review buddy” who is going to review my pull request.

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ ci:
99

1010
repos:
1111
- repo: https://github.com/asottile/pyupgrade
12-
rev: v3.4.0
12+
rev: v3.15.0
1313
hooks:
1414
- id: pyupgrade
1515
args: ["--py38-plus"]
1616

1717
- repo: https://github.com/adamchainz/django-upgrade
18-
rev: '1.13.0'
18+
rev: '1.15.0'
1919
hooks:
2020
- id: django-upgrade
2121
args: [--target-version, "3.2"]
2222

23-
- repo: https://github.com/charliermarsh/ruff-pre-commit
24-
rev: "v0.0.270"
23+
- repo: https://github.com/astral-sh/ruff-pre-commit
24+
rev: "v0.1.4"
2525
hooks:
2626
- id: ruff
2727
args: [--fix, --exit-non-zero-on-fix]
2828

2929
- repo: https://github.com/astral-sh/ruff-pre-commit
3030
# Ruff version.
31-
rev: v0.1.2
31+
rev: v0.1.4
3232
hooks:
3333
- id: ruff-format
3434

3535
- repo: https://github.com/pre-commit/pre-commit-hooks
36-
rev: v4.4.0
36+
rev: v4.5.0
3737
hooks:
3838
- id: check-added-large-files
3939
- id: check-case-conflict

aldryn_config.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ class Form(forms.BaseForm):
1111
required=False,
1212
)
1313
enable_search = forms.CheckboxField(
14-
'Enable snippet content to be searchable.',
14+
"Enable snippet content to be searchable.",
1515
required=False,
1616
initial=False,
1717
)
1818

1919
def to_settings(self, data, settings):
20-
if data['editor_theme']:
21-
settings['DJANGOCMS_SNIPPET_THEME'] = data['editor_theme']
22-
if data['editor_mode']:
23-
settings['DJANGOCMS_SNIPPET_MODE'] = data['editor_mode']
24-
if data['enable_search']:
25-
settings['DJANGOCMS_SNIPPET_SEARCH'] = data['enable_search']
20+
if data["editor_theme"]:
21+
settings["DJANGOCMS_SNIPPET_THEME"] = data["editor_theme"]
22+
if data["editor_mode"]:
23+
settings["DJANGOCMS_SNIPPET_MODE"] = data["editor_mode"]
24+
if data["enable_search"]:
25+
settings["DJANGOCMS_SNIPPET_SEARCH"] = data["enable_search"]
2626
return settings

tests/settings.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
#!/usr/bin/env python
22
HELPER_SETTINGS = {
3-
'INSTALLED_APPS': [
4-
'tests.utils',
3+
"INSTALLED_APPS": [
4+
"tests.utils",
55
],
6-
'CMS_LANGUAGES': {
7-
1: [{
8-
'code': 'en',
9-
'name': 'English',
10-
}]
6+
"CMS_LANGUAGES": {
7+
1: [
8+
{
9+
"code": "en",
10+
"name": "English",
11+
}
12+
]
1113
},
12-
'LANGUAGE_CODE': 'en',
13-
'ALLOWED_HOSTS': ['localhost'],
14+
"LANGUAGE_CODE": "en",
15+
"ALLOWED_HOSTS": ["localhost"],
1416
}
1517

1618

1719
def run():
1820
from app_helper import runner
19-
runner.cms('djangocms_snippet')
2021

22+
runner.cms("djangocms_snippet")
2123

22-
if __name__ == '__main__':
24+
25+
if __name__ == "__main__":
2326
run()

tests/test_migrations.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,23 @@
77

88

99
class MigrationTestCase(TestCase):
10-
1110
@override_settings(MIGRATION_MODULES={})
1211
def test_for_missing_migrations(self):
1312
output = StringIO()
1413
options = {
15-
'interactive': False,
16-
'dry_run': True,
17-
'stdout': output,
18-
'check_changes': True,
14+
"interactive": False,
15+
"dry_run": True,
16+
"stdout": output,
17+
"check_changes": True,
1918
}
2019

2120
try:
22-
call_command('makemigrations', **options)
21+
call_command("makemigrations", **options)
2322
except SystemExit as e:
2423
status_code = str(e)
2524
else:
2625
# the "no changes" exit code is 0
27-
status_code = '0'
26+
status_code = "0"
2827

29-
if status_code == '1':
30-
self.fail('There are missing migrations:\n {}'.format(output.getvalue()))
28+
if status_code == "1":
29+
self.fail(f"There are missing migrations:\n {output.getvalue()}")

tests/test_models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class SnippetModelTestCase(TestCase):
7-
87
def setUp(self):
98
pass
109

tests/test_plugins.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class SnippetPluginsTestCase(CMSTestCase):
8-
98
def setUp(self):
109
self.language = "en"
1110
self.home = create_page(
@@ -29,7 +28,9 @@ def tearDown(self):
2928
self.superuser.delete()
3029

3130
def test_html_rendering(self):
32-
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
31+
request_url = (
32+
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
33+
)
3334
snippet = Snippet.objects.create(
3435
name="plugin_snippet",
3536
html="<p>Hello World</p>",
@@ -52,7 +53,9 @@ def test_html_rendering(self):
5253
self.assertIn(b"<p>Hello World</p>", response.content)
5354

5455
def test_failing_html_rendering(self):
55-
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
56+
request_url = (
57+
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
58+
)
5659
snippet = Snippet.objects.create(
5760
name="plugin_snippet",
5861
html="{% import weirdness %}",
@@ -70,10 +73,14 @@ def test_failing_html_rendering(self):
7073
response = self.client.get(request_url)
7174

7275
self.assertContains(response, "Invalid block tag on line 1")
73-
self.assertContains(response, "Did you forget to register or load this tag?")
76+
self.assertContains(
77+
response, "Did you forget to register or load this tag?"
78+
)
7479

7580
def test_template_rendering(self):
76-
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
81+
request_url = (
82+
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
83+
)
7784
template = "snippet.html"
7885
snippet = Snippet.objects.create(
7986
name="plugin_snippet",
@@ -94,13 +101,22 @@ def test_template_rendering(self):
94101
with self.login_user_context(self.superuser):
95102
response = self.client.get(request_url)
96103

97-
self.assertNotIn("Template {} does not exist".format(template).encode(), response.content)
98-
self.assertNotIn(b"context must be a dict rather than Context", response.content)
99-
self.assertNotIn(b"context must be a dict rather than PluginContext", response.content)
104+
self.assertNotIn(
105+
f"Template {template} does not exist".encode(), response.content
106+
)
107+
self.assertNotIn(
108+
b"context must be a dict rather than Context", response.content
109+
)
110+
self.assertNotIn(
111+
b"context must be a dict rather than PluginContext",
112+
response.content,
113+
)
100114
self.assertContains(response, "<p>Hello World Template</p>")
101115

102116
def test_failing_template_rendering(self):
103-
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
117+
request_url = (
118+
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
119+
)
104120
template = "some_template"
105121
snippet = Snippet.objects.create(
106122
name="plugin_snippet",

tests/test_templatetags.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class SnippetTemplateTagTestCase(TestCase):
10-
1110
def test_html_rendered(self):
1211
snippet = Snippet.objects.create(
1312
name="test snippet",
@@ -20,17 +19,15 @@ def test_html_rendered(self):
2019

2120
context = Context({"title": "world"})
2221
template_to_render = Template(
23-
'{% load snippet_tags %}'
24-
'{% snippet_fragment "test_snippet" %}'
22+
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet" %}'
2523
)
2624
rendered_template = template_to_render.render(context)
27-
self.assertInHTML('<p>hello world</p>', rendered_template)
25+
self.assertInHTML("<p>hello world</p>", rendered_template)
2826

2927
# test html errors
3028
context = Context({"title": "world"})
3129
template_to_render = Template(
32-
'{% load snippet_tags %}'
33-
'{% snippet_fragment "test_snippet_2" %}'
30+
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet_2" %}'
3431
)
3532
with self.assertRaises(ObjectDoesNotExist):
3633
# Snippet matching query does not exist.
@@ -50,29 +47,27 @@ def test_template_rendered(self):
5047
# use a string to identify
5148
context = Context({})
5249
template_to_render = Template(
53-
'{% load snippet_tags %}'
54-
'{% snippet_fragment "test_snippet" %}'
50+
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet" %}'
5551
)
5652
rendered_template = template_to_render.render(context)
57-
self.assertInHTML('<p>Hello World Template</p>', rendered_template)
53+
self.assertInHTML("<p>Hello World Template</p>", rendered_template)
5854

5955
# use an id to identify
6056
context = Context({})
6157
template_to_render = Template(
62-
'{% load snippet_tags %}'
63-
'{% snippet_fragment 1 %}'
58+
"{% load snippet_tags %}" "{% snippet_fragment 1 %}"
6459
)
6560
rendered_template = template_to_render.render(context)
66-
self.assertInHTML('<p>Hello World Template</p>', rendered_template)
61+
self.assertInHTML("<p>Hello World Template</p>", rendered_template)
6762

6863
# tests "or" functionality
6964
context = Context({})
7065
template_to_render = Template(
71-
'{% load snippet_tags %}'
66+
"{% load snippet_tags %}"
7267
'{% snippet_fragment "test_snippet_1" or %}<p>hello world</p>{% endsnippet_fragment %}'
7368
)
7469
rendered_template = template_to_render.render(context)
75-
self.assertInHTML('<p>hello world</p>', rendered_template)
70+
self.assertInHTML("<p>hello world</p>", rendered_template)
7671

7772
def test_template_errors(self):
7873
template = "does_not_exist.html"
@@ -87,16 +82,16 @@ def test_template_errors(self):
8782

8883
context = Context({})
8984
template_to_render = Template(
90-
'{% load snippet_tags %}'
91-
'{% snippet_fragment "test_snippet" %}'
85+
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet" %}'
9286
)
9387
rendered_template = template_to_render.render(context)
94-
self.assertIn('Template does_not_exist.html does not exist.', rendered_template)
88+
self.assertIn(
89+
"Template does_not_exist.html does not exist.", rendered_template
90+
)
9591

9692
context = Context({})
9793
template_to_render = Template(
98-
'{% load snippet_tags %}'
99-
'{% snippet_fragment "test_snippet_1" %}'
94+
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet_1" %}'
10095
)
10196
with self.assertRaises(ObjectDoesNotExist):
10297
# Snippet object does not exist
@@ -106,6 +101,5 @@ def test_template_errors(self):
106101
with self.assertRaises(TemplateSyntaxError):
107102
# You need to specify at least a "snippet" ID, slug or instance
108103
template_to_render = Template(
109-
'{% load snippet_tags %}'
110-
'{% snippet_fragment %}'
104+
"{% load snippet_tags %}" "{% snippet_fragment %}"
111105
)

0 commit comments

Comments
 (0)