fix: resolve ruff/mypy lint errors and fix E2E test failures
- Use datetime.timedelta instead of timezone.timedelta (mypy) - Fix import ordering (ruff I001) - Fix admin sidebar E2E selector: use #wagtail-sidebar (Wagtail 7) - Set deterministic published_date on seeded E2E articles for stable ordering - Fix nightly test strict-mode violation: exact=True for Comments heading Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
from django.test import override_settings
|
||||
from django.utils import timezone
|
||||
@@ -32,7 +34,7 @@ def test_published_date_preserved_when_explicitly_set(home_page):
|
||||
index = ArticleIndexPage(title="Articles", slug="articles")
|
||||
home_page.add_child(instance=index)
|
||||
author = AuthorFactory()
|
||||
custom_date = timezone.now() - timezone.timedelta(days=30)
|
||||
custom_date = timezone.now() - timedelta(days=30)
|
||||
article = ArticlePage(
|
||||
title="Custom Date",
|
||||
slug="custom-date",
|
||||
@@ -60,7 +62,7 @@ def test_homepage_orders_articles_by_published_date(home_page):
|
||||
author=author,
|
||||
summary="s",
|
||||
body=[("rich_text", "<p>body</p>")],
|
||||
published_date=timezone.now() - timezone.timedelta(days=10),
|
||||
published_date=timezone.now() - timedelta(days=10),
|
||||
)
|
||||
index.add_child(instance=older)
|
||||
older.save_revision().publish()
|
||||
@@ -94,7 +96,7 @@ def test_article_index_orders_by_published_date(home_page, rf):
|
||||
author=author,
|
||||
summary="s",
|
||||
body=[("rich_text", "<p>b</p>")],
|
||||
published_date=timezone.now() - timezone.timedelta(days=5),
|
||||
published_date=timezone.now() - timedelta(days=5),
|
||||
)
|
||||
index.add_child(instance=old)
|
||||
old.save_revision().publish()
|
||||
|
||||
Reference in New Issue
Block a user