summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-18 12:46:03 -0400
committerTim Graham <timograham@gmail.com>2015-09-23 19:31:10 -0400
commit6a70cb53971a19f2d9e71d5ee24bfb0e844b4d9d (patch)
treea12774fd9787b8f8b4581daca60de6beacf8e943 /tests
parent3bbebd06adc36f31877a9c0af6c20c5b5a71a900 (diff)
Refs #19973 -- Removed optparse support in management commands per deprecation timeline.
Diffstat (limited to 'tests')
-rw-r--r--tests/user_commands/management/commands/optparse_cmd.py22
-rw-r--r--tests/user_commands/tests.py19
2 files changed, 2 insertions, 39 deletions
diff --git a/tests/user_commands/management/commands/optparse_cmd.py b/tests/user_commands/management/commands/optparse_cmd.py
deleted file mode 100644
index 09de44b200..0000000000
--- a/tests/user_commands/management/commands/optparse_cmd.py
+++ /dev/null
@@ -1,22 +0,0 @@
-from optparse import make_option
-
-from django.core.management.base import BaseCommand
-
-
-class Command(BaseCommand):
- help = "Test optparse compatibility."
- args = ''
-
- option_list = BaseCommand.option_list + (
- make_option("-s", "--style", default="Rock'n'Roll"),
- make_option("-x", "--example")
- )
-
- def handle(self, *args, **options):
- options["example"]
- # BaseCommand default option is available
- options['verbosity']
- assert (
- isinstance(options['verbosity'], int), "verbosity option is not int, but %s" % type(options['verbosity'])
- )
- self.stdout.write("All right, let's dance %s." % options["style"])
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
index a50e714c94..8bceccc487 100644
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -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)