Skip to content

Commit 5064ddb

Browse files
tainarapalmeirasarahboyce
authored andcommitted
[5.0.x] Refs #35844 -- Expanded compatibility for expected error messages in command tests on Python 3.12.
Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to use assertRaisesRegex() for compatibility with modified error messages in Python 3.12, 3.13, and 3.14+.. Backport of fc22fdd from main.
1 parent 901ec7a commit 5064ddb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/user_commands/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ def test_subparser_dest_required_args(self):
400400
self.assertIn("bar", out.getvalue())
401401

402402
def test_subparser_invalid_option(self):
403-
msg = "invalid choice: 'test' (choose from 'foo')"
404-
with self.assertRaisesMessage(CommandError, msg):
403+
msg = r"invalid choice: 'test' \(choose from '?foo'?\)"
404+
with self.assertRaisesRegex(CommandError, msg):
405405
management.call_command("subparser", "test", 12)
406406
msg = "Error: the following arguments are required: subcommand"
407407
with self.assertRaisesMessage(CommandError, msg):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy