Removed unnecessary capturing/hiding of stdout/stderr in various tests.

This commit is contained in:
François Freitag 2020-04-25 22:20:20 +02:00 committed by Mariusz Felisiak
parent a8d175c297
commit 687cb38a05
2 changed files with 3 additions and 4 deletions

View File

@ -1366,8 +1366,7 @@ class ManageTestserver(SimpleTestCase):
@mock.patch.object(LoaddataCommand, 'handle', return_value='') @mock.patch.object(LoaddataCommand, 'handle', return_value='')
@mock.patch.object(RunserverCommand, 'handle', return_value='') @mock.patch.object(RunserverCommand, 'handle', return_value='')
def test_params_to_runserver(self, mock_runserver_handle, mock_loaddata_handle, mock_create_test_db): def test_params_to_runserver(self, mock_runserver_handle, mock_loaddata_handle, mock_create_test_db):
out = StringIO() call_command('testserver', 'blah.json')
call_command('testserver', 'blah.json', stdout=out)
mock_runserver_handle.assert_called_with( mock_runserver_handle.assert_called_with(
addrport='', addrport='',
force_color=False, force_color=False,
@ -1678,7 +1677,7 @@ class CommandTypes(AdminScriptTestCase):
A command called from the command line should close connections after A command called from the command line should close connections after
being executed (#21255). being executed (#21255).
""" """
command = BaseCommand(stderr=StringIO()) command = BaseCommand()
command.check = lambda: [] command.check = lambda: []
command.handle = lambda *args, **kwargs: args command.handle = lambda *args, **kwargs: args
with mock.patch('django.core.management.base.connections') as mock_connections: with mock.patch('django.core.management.base.connections') as mock_connections:

View File

@ -254,7 +254,7 @@ class MigrateTests(MigrationTestBase):
}) })
def test_migrate_check(self): def test_migrate_check(self):
with self.assertRaises(SystemExit): with self.assertRaises(SystemExit):
call_command('migrate', 'migrations', '0001', check_unapplied=True, verbosity=0) call_command('migrate', 'migrations', '0001', check_unapplied=True)
self.assertTableNotExists('migrations_author') self.assertTableNotExists('migrations_author')
self.assertTableNotExists('migrations_tribble') self.assertTableNotExists('migrations_tribble')
self.assertTableNotExists('migrations_book') self.assertTableNotExists('migrations_book')