diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index 42bcd0a50b..42afd8091f 100644
a
|
b
|
class TestRaiseLastException(SimpleTestCase):
|
291 | 291 | with self.assertRaisesMessage(MyException, 'Test Message'): |
292 | 292 | autoreload.raise_last_exception() |
293 | 293 | |
| 294 | def test_raises_custom_exception(self): |
| 295 | class MyException(Exception): |
| 296 | def __init__(self, msg, extra_context): |
| 297 | super().__init__(msg) |
| 298 | self.extra_context = extra_context |
| 299 | |
| 300 | # Create an exception |
| 301 | try: |
| 302 | raise MyException('Test Message', 'extra context') |
| 303 | except MyException: |
| 304 | exc_info = sys.exc_info() |
| 305 | |
| 306 | with mock.patch('django.utils.autoreload._exception', exc_info): |
| 307 | with self.assertRaisesMessage(MyException, 'Test Message'): |
| 308 | autoreload.raise_last_exception() |
| 309 | |
294 | 310 | |
295 | 311 | class RestartWithReloaderTests(SimpleTestCase): |
296 | 312 | executable = '/usr/bin/python' |