Fixed #33082 -- Fixed CommandTests.test_subparser_invalid_option on Python 3.9.7+.

Thanks Michał Górny for the report.
This commit is contained in:
Mariusz Felisiak 2021-09-02 10:56:56 +02:00 committed by GitHub
parent d0ea01af28
commit 50ed545e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -17,7 +17,6 @@ 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
@ -334,9 +333,7 @@ class CommandTests(SimpleTestCase):
self.assertIn('bar', out.getvalue())
def test_subparser_invalid_option(self):
msg = "Error:%s invalid choice: 'test' (choose from 'foo')" % (
' argument {foo}:' if PY310 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'