def test_path_exists(self): fs = Filesystem() with patch.object(fs, 'exists'): with no_handlers_for_logger('mrjob.fs.base'): fs.path_exists('foo') fs.exists.assert_called_once_with('foo')
def test_path_join(self): fs = Filesystem() with patch.object(fs, 'join'): with no_handlers_for_logger('mrjob.fs.base'): fs.path_join('foo', 'bar') fs.join.assert_called_once_with('foo', 'bar')
def setUp(self): super(JoinTestCase, self).setUp() # os.path.join() and posixpath.join() do the same thing in # UNIX and OS X, so track which one we called self.start(patch('os.path.join', wraps=os.path.join)) self.start(patch('posixpath.join', wraps=posixpath.join)) self.fs = Filesystem()
def test_multiple_files(self): fs = Filesystem() fs.ls = Mock(return_value=['path1', 'path2', 'path3']) fs._cat_file = Mock(return_value=[b'chunk1\n', b'chunk2']) chunks = list(fs.cat('whatever')) self.assertEqual(chunks, [ b'chunk1\n', b'chunk2', b'', b'chunk1\n', b'chunk2', b'', b'chunk1\n', b'chunk2' ])
def setUp(self): super(JoinTestCase, self).setUp() self.fs = Filesystem()