Beispiel #1
0
    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')
Beispiel #2
0
    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')
Beispiel #3
0
    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())
Beispiel #4
0
    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())
Beispiel #5
0
 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')
Beispiel #6
0
 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')