Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency django to v4 #8

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions cms/test_utils/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from cms.utils.conf import get_cms_setting
from cms.utils.permissions import set_current_user
from cms.utils.urlutils import admin_reverse
from cms.exceptions import DuplicatePlaceholderWarning
from menus.menu_pool import menu_pool

URL_CMS_PAGE = "/en/admin/cms/page/"
Expand Down Expand Up @@ -440,23 +441,41 @@ def update(self, response):
request._messages = MockStorage()
return request

# TODO: Renable this.
# def failUnlessWarns(self, category, message, f, *args, **kwargs):
# warningsShown = []
# cleanwarningsShown = []
# result = _collectWarnings(warningsShown.append, f, *args, **kwargs)
#
# if not warningsShown:
# self.fail("No warnings emitted")
#
# for warning in warningsShown:
# # this specific warning is present due to the way Django
# # handle asyncio
# # https://stackoverflow.com/questions/70303895/python-3-10-asyncio-gather-shows-deprecationwarning-there-is-no-current-event
# duplicateplaceholderwarning = 'Duplicate {% placeholder "one" %} in template placeholder_tests/test_seven.html.'
# if warning.category not in (DeprecationWarning, DuplicatePlaceholderWarning) and warning.message not in ('There is no current event loop', duplicateplaceholderwarning):
# cleanwarningsShown.append(warning)
#
# first = cleanwarningsShown[0]
# for other in cleanwarningsShown[1:]:
# if ((other.message, other.category) != (first.message, first.category)):
# self.fail("Can't handle different warnings")
#
# self.assertEqual(first.message, message)
# self.assertTrue(first.category is category)
#
# return result

def failUnlessWarns(self, category, message, f, *args, **kwargs):
warningsShown = []
cleanwarningsShown = []
result = _collectWarnings(warningsShown.append, f, *args, **kwargs)

if not warningsShown:
self.fail("No warnings emitted")

for warning in warningsShown:
# this specific warning is present due to the way Django
# handle asyncio
# https://stackoverflow.com/questions/70303895/python-3-10-asyncio-gather-shows-deprecationwarning-there-is-no-current-event
if (warning.category != DeprecationWarning and warning.message != 'There is no current event loop'):
cleanwarningsShown.append(warning)

first = cleanwarningsShown[0]
for other in cleanwarningsShown[1:]:
first = warningsShown[0]
for other in warningsShown[1:]:
if ((other.message, other.category) != (first.message, first.category)):
self.fail("Can't handle different warnings")

Expand All @@ -465,6 +484,7 @@ def failUnlessWarns(self, category, message, f, *args, **kwargs):

return result


assertWarns = failUnlessWarns

def load_template_from_string(self, template):
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ coverage==6.3.2
# via -r requirements.in
datetime==4.4
# via -r requirements.in
django==3.2.12
django==4.0.9
# via
# -r requirements.in
# django-classy-tags
Expand Down