mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Removed BaseCommand.stdin introduced in 116d39842d
.
This option is not actually very useful in the general case because it doesn't override sys.stdin. It's still marginally useful for testing some features of the createsuperuser command so it was moved there. This commit also makes the detection of a TTY in createsuperuser a bit more robust, after a suggestion of appolo13.
This commit is contained in:
parent
b78f9a12c8
commit
2a9ee49f3c
4 changed files with 34 additions and 28 deletions
|
@ -61,32 +61,6 @@ class CommandTests(SimpleTestCase):
|
|||
management.call_command('leave_locale_alone_true', stdout=out)
|
||||
self.assertEqual(out.getvalue(), "pl\n")
|
||||
|
||||
def test_passing_stdin(self):
|
||||
"""
|
||||
You can pass a stdin object to a command's options and it should be
|
||||
available on self.stdin.
|
||||
"""
|
||||
class CustomCommand(BaseCommand):
|
||||
def handle(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
sentinel = object()
|
||||
command = CustomCommand()
|
||||
command.execute(stdin=sentinel, stdout=StringIO())
|
||||
self.assertIs(command.stdin, sentinel)
|
||||
|
||||
def test_passing_stdin_default(self):
|
||||
"""
|
||||
If stdin is not passed as an option, the default should be sys.stdin.
|
||||
"""
|
||||
class CustomCommand(BaseCommand):
|
||||
def handle(self, *args, **kwargs):
|
||||
return 'OK'
|
||||
|
||||
command = CustomCommand()
|
||||
command.execute(stdout=StringIO())
|
||||
self.assertIs(command.stdin, sys.stdin)
|
||||
|
||||
|
||||
class UtilsTests(SimpleTestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue