Skip to content

Commit b0ae8ac

Browse files
authored
Merge pull request #59 from torchbox-forks/support/wagtail-64
Update tox testing to reflect Wagtail 6.4
2 parents f5dffef + 0c2f7a1 commit b0ae8ac

4 files changed

Lines changed: 27 additions & 20 deletions

File tree

CHANGELOG.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
unreleased
1+
Unreleased
22
----------
33

4-
- Wagtail 6.3 support/testing
5-
4+
* Add tests for Wagtail 6.3, 6.4 and Python 3.13 (@ianmeigh)
5+
* Update tests to consider tasks managed by django-tasks are now deferred until
6+
the current transaction is committed (@ianmeigh)
67

78
2.0 - 18th September 2024
89
-------------------------

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ classifiers =
1616
Programming Language :: Python :: 3.10
1717
Programming Language :: Python :: 3.11
1818
Programming Language :: Python :: 3.12
19+
Programming Language :: Python :: 3.13
1920
Topic :: Internet :: WWW/HTTP
2021
Framework :: Django
2122
Framework :: Django :: 4.2

tox.ini

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[tox]
22
envlist =
3-
py{310,311}-dj42-wagtail{52,62,63}
4-
py{311,312}-dj{50}-wagtail{52,62,63}
5-
py{311,312}-dj{51}-wagtail{63}
3+
py{310,311}-dj42-wagtail{52,63,64}
4+
py{311,312}-dj{50}-wagtail{52,63,64}
5+
py{311,312,313}-dj{51}-wagtail{63,64}
66
flake8
77
isort
88
black
@@ -12,6 +12,7 @@ python =
1212
3.10: py310
1313
3.11: py311
1414
3.12: py312
15+
3.13: py313
1516

1617
[testenv]
1718
use_frozen_constraints = true
@@ -25,12 +26,12 @@ deps =
2526
dj50: Django>=5.0,<5.1
2627
dj51: Django>=5.1,<5.2
2728
wagtail52: wagtail>=5.2,<5.3
28-
wagtail62: wagtail>=6.2,<6.3
2929
wagtail63: wagtail>=6.3,<6.4
30+
wagtail64: wagtail>=6.4,<6.5
3031
wagtailmain: git+https://github.com/wagtail/wagtail.git@main#egg=Wagtail
3132

3233
commands =
33-
coverage run --source="{toxinidir}/wagtail_storages" -m django test wagtail_storages
34+
coverage run --source="{toxinidir}/wagtail_storages" -m django test {posargs:wagtail_storages}
3435
django-admin check
3536
django-admin makemigrations --check --noinput
3637
coverage report -m --omit="{toxinidir}/wagtail_storages/tests/*" --fail-under=80

wagtail_storages/tests/test_signal_handlers.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ def test_cache_purged_for_private_collection(self):
108108
private_collection = CollectionViewRestrictionFactory().collection
109109
DocumentFactory(collection=private_collection)
110110
with mock.patch(URLOPEN_PATH) as urlopen_mock:
111-
purge_documents_when_collection_saved_with_restrictions(
112-
sender=private_collection._meta.model, instance=private_collection
113-
)
111+
with self.captureOnCommitCallbacks(execute=True):
112+
purge_documents_when_collection_saved_with_restrictions(
113+
sender=private_collection._meta.model, instance=private_collection
114+
)
114115
urlopen_mock.assert_called()
115116

116117
@override_settings(
@@ -132,9 +133,10 @@ def test_cache_not_purged_for_public_collection(self):
132133
collection = CollectionFactory()
133134
DocumentFactory.create_batch(10, collection=collection)
134135
with mock.patch(URLOPEN_PATH) as urlopen_mock:
135-
purge_documents_when_collection_saved_with_restrictions(
136-
sender=collection._meta.model, instance=collection
137-
)
136+
with self.captureOnCommitCallbacks(execute=True):
137+
purge_documents_when_collection_saved_with_restrictions(
138+
sender=collection._meta.model, instance=collection
139+
)
138140
urlopen_mock.assert_not_called()
139141

140142

@@ -158,9 +160,10 @@ class TestPurgeDocumentFromCacheWhenSaved(CreateBucket, TestCase):
158160
def test_create_new_document_purges_cache_for_that_url(self):
159161
document = DocumentFactory()
160162
with mock.patch(URLOPEN_PATH) as urlopen_mock:
161-
purge_document_from_cache_when_saved(
162-
sender=document._meta.model, instance=document
163-
)
163+
with self.captureOnCommitCallbacks(execute=True):
164+
purge_document_from_cache_when_saved(
165+
sender=document._meta.model, instance=document
166+
)
164167
urlopen_mock.assert_called()
165168

166169
@override_settings(
@@ -181,7 +184,8 @@ def test_create_new_document_purges_cache_for_that_url(self):
181184
def test_delete_document_purges_cache_for_that_url(self):
182185
document = DocumentFactory()
183186
with mock.patch(URLOPEN_PATH) as urlopen_mock:
184-
purge_document_from_cache_when_deleted(
185-
sender=document._meta.model, instance=document
186-
)
187+
with self.captureOnCommitCallbacks(execute=True):
188+
purge_document_from_cache_when_deleted(
189+
sender=document._meta.model, instance=document
190+
)
187191
urlopen_mock.assert_called()

0 commit comments

Comments
 (0)