def test_paths(self): self.mock_paths = [ '/path/to/logs/oak', '/path/to/logs/pine', '/path/to/logs/redwood', ] self.assertEqual(list(_ls_logs(self.mock_fs, '/path/to/logs')), self.mock_paths) self.mock_fs.ls.assert_called_once_with('/path/to/logs')
def test_io_error(self): self.mock_paths = [ IOError(), ] with no_handlers_for_logger('mrjob.logs.ls'): stderr = StringIO() log_to_stream('mrjob.logs.ls', stderr) self.assertEqual(list(_ls_logs(self.mock_fs, '/path/to/logs')), []) self.mock_fs.ls.assert_called_once_with('/path/to/logs') self.assertIn("couldn't ls() /path/to/logs", stderr.getvalue())
def test_empty(self): self.assertEqual(list(_ls_logs(self.mock_fs, '/path/to/logs')), []) self.mock_fs.ls.assert_called_once_with('/path/to/logs')