Skip to content

Commit ea4a1fb

Browse files
tainarapalmeirasarahboyce
authored andcommitted
[4.2.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 345a665 commit ea4a1fb

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
@@ -399,8 +399,8 @@ def test_subparser_dest_required_args(self):
399399
self.assertIn("bar", out.getvalue())
400400

401401
def test_subparser_invalid_option(self):
402-
msg = "invalid choice: 'test' (choose from 'foo')"
403-
with self.assertRaisesMessage(CommandError, msg):
402+
msg = r"invalid choice: 'test' \(choose from '?foo'?\)"
403+
with self.assertRaisesRegex(CommandError, msg):
404404
management.call_command("subparser", "test", 12)
405405
msg = "Error: the following arguments are required: subcommand"
406406
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