diff options
author | Michał Górny <mgorny@gentoo.org> | 2021-08-03 10:04:22 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-08-04 07:59:08 +0200 |
commit | 7afca03c4058c25f2e1cec8d0b07c2157c93e831 (patch) | |
tree | 1a14ce076b33c6ba9dc0600c1e6dfb8600a5b07d /tests/user_commands | |
parent | 4f3acf957918843b4c40ff2edfb929bcfaa3730e (diff) | |
download | django-7afca03c4058c25f2e1cec8d0b07c2157c93e831.tar.gz |
Refs #32074 -- Fixed CommandTests.test_subparser_invalid_option on Python 3.10+.
Python 3.10.0rc1 changed the error messages issued by argparse on
invalid choice to include the argument name. Update the expected test
output to account for that.
Diffstat (limited to 'tests/user_commands')
-rw-r--r-- | tests/user_commands/tests.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py index 05415717c6..2e5589647a 100644 --- a/tests/user_commands/tests.py +++ b/tests/user_commands/tests.py @@ -17,6 +17,7 @@ from django.test import SimpleTestCase, override_settings from django.test.utils import captured_stderr, extend_sys_path, ignore_warnings from django.utils import translation from django.utils.deprecation import RemovedInDjango41Warning +from django.utils.version import PY310 from .management.commands import dance @@ -333,7 +334,9 @@ class CommandTests(SimpleTestCase): self.assertIn('bar', out.getvalue()) def test_subparser_invalid_option(self): - msg = "Error: invalid choice: 'test' (choose from 'foo')" + msg = "Error:%s invalid choice: 'test' (choose from 'foo')" % ( + ' argument {foo}:' if PY310 else '' + ) with self.assertRaisesMessage(CommandError, msg): management.call_command('subparser', 'test', 12) msg = 'Error: the following arguments are required: subcommand' |