Fixed #32094 -- Fixed flush() calls on management command self.stdout/err proxies.

This commit is contained in:
Thomas Riccardi 2020-10-08 20:41:22 +02:00 committed by Mariusz Felisiak
parent b7da588e88
commit f1f24539d8
3 changed files with 19 additions and 0 deletions

View file

@ -341,6 +341,13 @@ class CommandTests(SimpleTestCase):
parser = BaseCommand().create_parser('prog_name', 'subcommand', epilog=epilog)
self.assertEqual(parser.epilog, epilog)
def test_outputwrapper_flush(self):
out = StringIO()
with mock.patch.object(out, 'flush') as mocked_flush:
management.call_command('outputwrapper', stdout=out)
self.assertIn('Working...', out.getvalue())
self.assertIs(mocked_flush.called, True)
class CommandRunTests(AdminScriptTestCase):
"""