def test_setting_nofile_limit_os_fail(self, mock_setrlimit, *unused_mocks): """Assert that setting a rlimit greater than allow is handled well.""" mock_setrlimit.side_effect = resource.error('No files for you') hub_command = HubCommand() hub_command.log = mock.Mock() hub_command.set_rlimit_nofiles(limit=1844674407370) hub_command.log.warning.assert_called_once()
def test_setting_nofile_limit(self, mock_setrlimit, *unused_mocks): """Assert setting the default rlimit works.""" hub_command = HubCommand() hub_command.set_rlimit_nofiles(limit=1) mock_setrlimit.assert_called_once_with( resource.RLIMIT_NOFILE, (1, 1))
def test_setting_nofile_limit(self, mock_setrlimit, *unused_mocks): """Assert setting the default rlimit works.""" hub_command = HubCommand() hub_command.set_rlimit_nofiles(limit=1) mock_setrlimit.assert_called_once_with(resource.RLIMIT_NOFILE, (1, 1))