Commit Graph

85 Commits

Author SHA1 Message Date
Adam Johnson 017fa23d3b Fixed #34259 -- Passed called_from_command_line to command subparsers. 2023-02-03 06:56:57 +01:00
Mariusz Felisiak 829f4d1448
Refs #31546, Refs #34118 -- Corrected CommandTests.test_requires_system_checks_specific().
System checks are never called without skip_checks=False. Moreover,
called_once_with() is not a proper assertion and raise AttributeError
on Python 3.12.
2023-01-11 05:36:40 +01:00
Abhinav Yadav 2887b9f67c
Fixed #33657 -- Allowed customizing formatter class of argument parsers. 2022-06-20 17:34:52 +02:00
Mariusz Felisiak 7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Hasan Ramezani c1e4111c74 Fixed #33205 -- Made call_command() raise TypeError when dest with multiple arguments is passed. 2021-10-25 07:48:06 +02:00
Mariusz Felisiak 1cb495074f Refs #31546 -- Removed support for boolean values in Command.requires_system_checks.
Per deprecation timeline.
2021-09-20 21:23:01 +02:00
Mariusz Felisiak 50ed545e2f
Fixed #33082 -- Fixed CommandTests.test_subparser_invalid_option on Python 3.9.7+.
Thanks Michał Górny for the report.
2021-09-02 10:56:56 +02:00
Michał Górny 7afca03c40 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.
2021-08-04 07:59:08 +02:00
Mariusz Felisiak ec0ff40631 Fixed #32355 -- Dropped support for Python 3.6 and 3.7 2021-02-10 10:20:54 +01:00
Hasan Ramezani f06beea929 Fixed #32153 -- Fixed management commands when using required list options.
Thanks Mark Gajdosik for the report and initial patch.
2020-10-30 12:01:33 +01:00
Thomas Riccardi f1f24539d8 Fixed #32094 -- Fixed flush() calls on management command self.stdout/err proxies. 2020-10-09 12:59:00 +02:00
Hasan Ramezani efe74fff25 Refs #32047 -- Added test for using call_command() with constant required options. 2020-10-06 08:23:25 +02:00
Hasan Ramezani 6eb3f53bdd Fixed #32047 -- Fixed call_command() crash if a constant option from required mutually exclusive group is passed in options. 2020-09-30 20:10:38 +02:00
René Fleschenberg 578b3046e3 Reverted "Refs #23919 -- Removed obsolete __init__.py files in management command directories."
This reverts commit ccc25bfe4f.

https://groups.google.com/d/topic/django-developers/GVHMH2ciAnk/discussion
2020-06-01 10:55:41 +02:00
Hasan Ramezani c60524c658 Fixed #31546 -- Allowed specifying list of tags in Command.requires_system_checks. 2020-05-21 12:34:54 +02:00
François Freitag c86201b6ed Disabled management commands output with verbosity 0 in various tests.
Instead of capturing the command output and discard it immediately,
tell the command not to log.
2020-04-20 09:09:26 +02:00
Adam Johnson 8e8c3f964e Refs #29501 -- Allowed customizing exit status for management commands. 2020-04-14 13:22:47 +02:00
François Freitag e03eb8db93 Fixed #31428 -- Allowed empty message in management command self.stdout/err proxies. 2020-04-07 08:45:11 +02:00
Hasan Ramezani 6c379f1a18 Fixed #30763 -- Fixed management commands when using required mutually exclusive groups. 2019-09-06 10:55:24 +02:00
Hasan Ramezani 2b03e8e9e8 Fixed #30584 -- Fixed management command when using subparsers with dest parameter. 2019-06-28 12:51:26 +02:00
Jon Dufresne 6866c91b63 Fixed #30418 -- Added --skip-checks management command option. 2019-04-30 10:48:30 +02:00
Jon Dufresne 487d904bf2 Simplified temporary directory handling in AdminScriptTestCase.
Use tempfile.TemporaryDirectory() in AdminScriptTestCase.setUp()
to create and destroy a temporary directory for each test. It removes
the need for individual tests to delete files.

For test classes that don't use the temporary directory, inherit from
SimpleTestCase.
2019-02-05 12:11:54 -05:00
rsiemens bc9f0b3203 Refs #29973 -- Extracted helper functions from makemessages. 2019-01-28 18:23:41 -05:00
Tim Graham 043bd70942 Updated test URL patterns to use path() and re_path(). 2018-12-31 10:47:32 -05:00
Hasan Ramezani 5195b99e2c Fixed #29560 -- Added --force-color management command option. 2018-09-11 11:15:42 -04:00
Hasan Ramezani 03e918d717 Added test for django.core.management.utils.get_random_secret_key(). 2018-08-05 16:06:31 -04:00
Claude Paroz eac9ab7ebb Removed parser.add_arguments() arguments that match the defaults. 2018-07-02 17:54:57 -04:00
humbertotm e95008f241 Fixed #29152 -- Allowed passing kwargs to ArgumentParser initialization in management commands. 2018-06-16 15:54:59 -04:00
Claude Paroz ce3351b950 Fixed #29301 -- Added custom help formatter to BaseCommand class
This partially reverts c3055242c8.
Thanks Adam Johnson and Carlton Gibson for the reviews.
2018-06-06 19:16:10 +02:00
Ryan P Kilby 2dcc5d629a Fixed #29392 -- Disallowed use of abbreviated forms of --settings and --pythonpath management command options. 2018-05-14 22:18:22 -04:00
Claude Paroz d65b0f72de Fixed #17379 -- Removed management commands deactivation of the locale. 2018-05-13 10:21:53 +02:00
Hasan Ramezani dd68b51e1d Fixed #29295 -- Fixed management command crash when using subparsers.
Thanks Tim Graham for the fix.
2018-04-21 17:33:17 -04:00
Alex Tomic a1a3e51561 Fixed #29133 -- Fixed call_command() crash if a required option is passed in options. 2018-03-02 12:25:08 -05:00
я котик пур-пур ccc25bfe4f Refs #23919 -- Removed obsolete __init__.py files in management command directories. 2018-01-03 11:02:26 -05:00
Mads Jensen a51c4de194 Used assertRaisesMessage() to test Django's error messages. 2017-07-29 19:07:23 -04:00
Chandrakant Kumar 2b09e4c88e Fixed #27787 -- Made call_command() validate the options it receives. 2017-06-16 21:28:38 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Jon Dufresne 7bbb5161ea Removed implicit default store_true/false argparse args.
argparse automatically sets the default value for store_true/false
arguments to its opposite.
2017-04-01 20:03:56 -04:00
Tim Graham 7aba69145d Refs #23919 -- Removed django.test.mock Python 2 compatibility shim. 2017-01-20 08:17:20 -05:00
Tim Graham 4e729feaa6 Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Claude Paroz 2b281cc35e Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Adam Chainz 7dc8d9238a Skipped unnecessary system checks in user_commands test. 2017-01-09 17:23:24 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Claude Paroz 122c90a43b Fixed #27305 -- Removed BaseCommand.can_import_settings unused attribute
Thanks Tim Graham for the review.
2016-10-02 20:31:56 +02:00
Dmitry Dygalo ca32979cdc
Made miscellaneous code cleanups 2016-07-21 10:08:19 -04:00
Jon Dufresne 4f336f6652 Fixed #26747 -- Used more specific assertions in the Django test suite. 2016-06-16 14:19:18 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Claude Paroz b46c0ea6c8 Fixed #26190 -- Returned handle() result from call_command
Thanks Tim Graham for the review.
2016-02-23 09:12:12 +01:00
Tim Graham 1ac7fdcd13 Refs #25304 -- Added assertion for Command.requires_migrations_checks default. 2016-02-15 09:39:55 -05:00