Refs -- Added test for command --help output with default options and custom arguments.
@@ -1496,6 +1496,31 @@ class CommandTypes(AdminScriptTestCase):
self.assertLess(tag_location, version_location)
self.assertOutput(out, "Checks the entire Django project for potential problems.")
+ def test_help_default_options_with_custom_arguments(self):
+ args = ['base_command', '--help']
+ out, err = self.run_manage(args)
+ self.assertNoOutput(err)
+ expected_options = [
+ '-h',
+ '--option_a OPTION_A',
+ '--option_b OPTION_B',
+ '--option_c OPTION_C',
+ '--version',
+ '-v {0,1,2,3}',
+ '--settings SETTINGS',
+ '--pythonpath PYTHONPATH',
+ '--traceback',
+ '--no-color',
+ '--force-color',
+ 'args ...',
+ ]
+ for option in expected_options:
+ self.assertOutput(out, f'[{option}]')
+ self.assertOutput(out, '--option_a OPTION_A, -a OPTION_A')
+ self.assertOutput(out, '--option_b OPTION_B, -b OPTION_B')
+ self.assertOutput(out, '--option_c OPTION_C, -c OPTION_C')
+ self.assertOutput(out, '-v {0,1,2,3}, --verbosity {0,1,2,3}')
+
def test_color_style(self):
style = color.no_style()
self.assertEqual(style.ERROR('Hello, world!'), 'Hello, world!')
