mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[5.1.x] Fixed #35666 -- Documented stacklevel usage and testing, and adjusted test suite accordingly.
Over the years we've had multiple instances of hit and misses when
emitting warnings: either setting the wrong stacklevel or not setting
it at all.
This work adds assertions for the existing warnings that were declaring
the correct stacklevel, but were lacking tests for it.
Backport of 57307bbc7d from main.
This commit is contained in:
@@ -163,9 +163,10 @@ class URLFieldAssumeSchemeDeprecationTest(FormFieldAssertionsMixin, SimpleTestCa
|
||||
"or set the FORMS_URLFIELD_ASSUME_HTTPS transitional setting to True to "
|
||||
"opt into using 'https' as the new default scheme."
|
||||
)
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||
f = URLField()
|
||||
self.assertEqual(f.clean("example.com"), "http://example.com")
|
||||
self.assertEqual(ctx.filename, __file__)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango60Warning)
|
||||
def test_urlfield_forms_urlfield_assume_https(self):
|
||||
|
||||
Reference in New Issue
Block a user