mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #35844 -- Corrected expected error messages in commands tests on Python 3.14+.
Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to address changes in Python 3.14+ error handling.
This commit is contained in:
committed by
Sarah Boyce
parent
7a1fa20e9b
commit
4c3897bb15
@@ -20,6 +20,7 @@ from django.db import connection
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
from django.test.utils import captured_stderr, extend_sys_path
|
||||
from django.utils import translation
|
||||
from django.utils.version import PY314
|
||||
|
||||
from .management.commands import dance
|
||||
|
||||
@@ -400,7 +401,10 @@ class CommandTests(SimpleTestCase):
|
||||
self.assertIn("bar", out.getvalue())
|
||||
|
||||
def test_subparser_invalid_option(self):
|
||||
msg = "invalid choice: 'test' (choose from 'foo')"
|
||||
if PY314:
|
||||
msg = "invalid choice: 'test' (choose from foo)"
|
||||
else:
|
||||
msg = "invalid choice: 'test' (choose from 'foo')"
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
management.call_command("subparser", "test", 12)
|
||||
msg = "Error: the following arguments are required: subcommand"
|
||||
|
||||
Reference in New Issue
Block a user