1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #31327 -- Deprecated providing_args argument for Signal.

This commit is contained in:
Jon Dufresne
2020-03-01 09:22:03 -08:00
committed by Carlton Gibson
parent 5ca76baa72
commit 769cee5252
12 changed files with 68 additions and 47 deletions

View File

@@ -0,0 +1,22 @@
import warnings
from django.dispatch import Signal
from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango40Warning
class SignalDeprecationTests(SimpleTestCase):
def test_providing_args_warning(self):
msg = (
'The providing_args argument is deprecated. As it is purely '
'documentational, it has no replacement. If you rely on this '
'argument as documentation, you can move the text to a code '
'comment or docstring.'
)
with self.assertWarnsMessage(RemovedInDjango40Warning, msg):
Signal(providing_args=['arg1', 'arg2'])
def test_without_providing_args_does_not_warn(self):
with warnings.catch_warnings(record=True) as recorded:
Signal()
self.assertEqual(len(recorded), 0)