mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Refs #19973 -- Removed optparse support in management commands per deprecation timeline.
This commit is contained in:
parent
3bbebd06ad
commit
6a70cb5397
8 changed files with 47 additions and 209 deletions
|
@ -5,11 +5,10 @@ from django.core import management
|
|||
from django.core.management import BaseCommand, CommandError, find_commands
|
||||
from django.core.management.utils import find_command, popen_wrapper
|
||||
from django.db import connection
|
||||
from django.test import SimpleTestCase, ignore_warnings, override_settings
|
||||
from django.test.utils import captured_stderr, captured_stdout, extend_sys_path
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
from django.test.utils import captured_stderr, extend_sys_path
|
||||
from django.utils import translation
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.six import StringIO
|
||||
|
||||
|
||||
|
@ -104,20 +103,6 @@ class CommandTests(SimpleTestCase):
|
|||
self.assertNotIn("opt_3", out.getvalue())
|
||||
self.assertNotIn("opt-3", out.getvalue())
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_optparse_compatibility(self):
|
||||
"""
|
||||
optparse should be supported during Django 1.8/1.9 releases.
|
||||
"""
|
||||
out = StringIO()
|
||||
management.call_command('optparse_cmd', stdout=out)
|
||||
self.assertEqual(out.getvalue(), "All right, let's dance Rock'n'Roll.\n")
|
||||
|
||||
# Simulate command line execution
|
||||
with captured_stdout() as stdout, captured_stderr():
|
||||
management.execute_from_command_line(['django-admin', 'optparse_cmd'])
|
||||
self.assertEqual(stdout.getvalue(), "All right, let's dance Rock'n'Roll.\n")
|
||||
|
||||
def test_calling_a_command_with_only_empty_parameter_should_ends_gracefully(self):
|
||||
out = StringIO()
|
||||
management.call_command('hal', "--empty", stdout=out)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue