summaryrefslogtreecommitdiff
path: root/tests/user_commands
diff options
context:
space:
mode:
authorTainara Palmeira <tainarapalmeirag@gmail.com>2024-10-24 11:27:56 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-10-25 13:30:11 +0200
commit4c3897bb154a3d3a94e5f7e146d0b8bf41e27d81 (patch)
treee9f5a864b13653a2cbea0632b3a2a1487dc6a3c1 /tests/user_commands
parent7a1fa20e9bca47c4c70734aec99209e402e0f076 (diff)
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.
Diffstat (limited to 'tests/user_commands')
-rw-r--r--tests/user_commands/tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
index 65e176620d..8dd07e1c67 100644
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -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"