Exemple #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')
Exemple #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')
Exemple #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())
Exemple #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())
Exemple #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')
Exemple #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')