Skip to content

Commit 946ac0e

Browse files
[MegaLinter] Apply linters fixes
1 parent f0ec312 commit 946ac0e

6 files changed

Lines changed: 34 additions & 47 deletions

File tree

tests/framework_wagtail/dummy_app/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
# limitations under the License.
1414

1515
from django.db import models
16-
from wagtail.models import Page
1716
from wagtail.contrib.routable_page.models import RoutablePage, re_path
1817
from wagtail.fields import RichTextField
18+
from wagtail.models import Page
19+
1920

2021
class HomePage(Page):
2122
body = RichTextField(blank=True)
Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
from django.db import migrations, models
2-
import wagtail.fields
31
import django.db.models.deletion
42
import wagtail.contrib.routable_page.models
3+
import wagtail.fields
4+
from django.db import migrations, models
55

66

77
class Migration(migrations.Migration):
8-
9-
dependencies = [
10-
("wagtailcore", "0070_rename_pagerevision_revision"),
11-
]
8+
dependencies = [("wagtailcore", "0070_rename_pagerevision_revision")]
129

1310
operations = [
1411
migrations.CreateModel(
@@ -24,31 +21,29 @@ class Migration(migrations.Migration):
2421
serialize=False,
2522
to="wagtailcore.Page",
2623
),
27-
),
24+
)
2825
],
29-
options={
30-
"abstract": False,
31-
},
26+
options={"abstract": False},
3227
bases=("wagtailcore.page",),
3328
),
34-
migrations.AddField(
35-
model_name='homepage',
36-
name='body',
37-
field=wagtail.fields.RichTextField(blank=True),
38-
),
29+
migrations.AddField(model_name="homepage", name="body", field=wagtail.fields.RichTextField(blank=True)),
3930
migrations.CreateModel(
40-
name='RoutablePage',
31+
name="RoutablePage",
4132
fields=[
42-
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
33+
(
34+
"page_ptr",
35+
models.OneToOneField(
36+
auto_created=True,
37+
on_delete=django.db.models.deletion.CASCADE,
38+
parent_link=True,
39+
primary_key=True,
40+
serialize=False,
41+
to="wagtailcore.page",
42+
),
43+
)
4344
],
44-
options={
45-
'verbose_name': 'Routable page',
46-
},
45+
options={"verbose_name": "Routable page"},
4746
bases=(wagtail.contrib.routable_page.models.RoutablePage,),
4847
),
49-
migrations.AddField(
50-
model_name='routablepage',
51-
name='body',
52-
field=wagtail.fields.RichTextField(blank=True),
53-
),
48+
migrations.AddField(model_name="routablepage", name="body", field=wagtail.fields.RichTextField(blank=True)),
5449
]

tests/framework_wagtail/settings.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@
6262
"django.contrib.staticfiles",
6363
]
6464

65-
DATABASES = {
66-
"default": {
67-
"ENGINE": "django.db.backends.sqlite3",
68-
"NAME": Path(BASE_DIR) / "db.sqlite3",
69-
}
70-
}
65+
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": Path(BASE_DIR) / "db.sqlite3"}}
7166

7267
MIGRATION_MODULES = {"dummy_app": "migrations"}

tests/framework_wagtail/test_application.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
import os
1616

1717
import pytest
18-
1918
from testing_support.fixtures import (
2019
collector_agent_registration_fixture,
21-
collector_available_fixture, # noqa: F401 # autouse fixture, must be importable in this module
20+
collector_available_fixture, # autouse fixture, must be importable in this module
2221
)
2322
from testing_support.validators.validate_transaction_metrics import validate_transaction_metrics
2423

25-
2624
_default_settings = {
2725
"package_reporting.enabled": False, # Turn off package reporting for testing as it causes slow downs.
2826
"transaction_tracer.explain_threshold": 0.0,
@@ -37,6 +35,7 @@
3735
app_name="Python Agent Test (framework_wagtail)", default_settings=_default_settings, scope="module"
3836
)
3937

38+
4039
@pytest.fixture(autouse=True)
4140
def database():
4241
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
@@ -51,9 +50,8 @@ def database():
5150
# ``Page``) and a default ``Site``. Replace that root with a ``HomePage``
5251
# and hang a ``RoutablePage`` beneath it so that "/" and "/routable/"
5352
# resolve to real, renderable pages served by the dummy_app page types.
54-
from wagtail.models import Page, Site
55-
5653
from dummy_app.models import HomePage, RoutablePage
54+
from wagtail.models import Page, Site
5755

5856
if not HomePage.objects.exists():
5957
site = Site.objects.get(is_default_site=True)
@@ -64,6 +62,7 @@ def database():
6462
default_home.delete()
6563
home.add_child(instance=RoutablePage(title="Routable", slug="routable"))
6664

65+
6766
def target_application():
6867
from _target_application import _target_application
6968

@@ -78,7 +77,7 @@ def target_application():
7877
("Python/WSGI/Response", 1),
7978
("Python/WSGI/Finalize", 1),
8079
("Function/wagtail.views:serve", 1),
81-
]
80+
],
8281
)
8382
def test_home():
8483
test_application = target_application()
@@ -93,7 +92,7 @@ def test_home():
9392
("Python/WSGI/Response", 1),
9493
("Python/WSGI/Finalize", 1),
9594
("Function/wagtail.views:serve", 1),
96-
]
95+
],
9796
)
9897
def test_routable():
9998
test_application = target_application()
@@ -108,7 +107,7 @@ def test_routable():
108107
("Python/WSGI/Response", 1),
109108
("Python/WSGI/Finalize", 1),
110109
("Function/wagtail.views:serve", 1),
111-
]
110+
],
112111
)
113112
def test_routable_routable():
114113
test_application = target_application()

tests/framework_wagtail/urls.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
from django.conf import settings
15-
from django.urls import include, path
1615
from django.contrib import admin
17-
18-
from wagtail.admin import urls as wagtailadmin_urls
16+
from django.urls import include, path
1917
from wagtail import urls as wagtail_urls
18+
from wagtail.admin import urls as wagtailadmin_urls
2019
from wagtail.documents import urls as wagtaildocs_urls
2120

22-
2321
urlpatterns = [
2422
path("django-admin/", admin.site.urls),
2523
path("admin/", include(wagtailadmin_urls)),
2624
path("documents/", include(wagtaildocs_urls)),
2725
]
28-
urlpatterns = [*urlpatterns,
26+
urlpatterns = [
27+
*urlpatterns,
2928
# For anything not caught by a more specific rule above, hand over to
3029
# Wagtail's page serving mechanism. This should be the last pattern in
3130
# the list:

tests/framework_wagtail/wsgi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,3 @@
4545
from django.core.wsgi import get_wsgi_application
4646

4747
application = get_wsgi_application()
48-
49-

0 commit comments

Comments
 (0)