def test_run_folder_exception(self, mock_isdir, mock_walk, mock_run_importanize, mock_parser): mock_run_importanize.side_effect = ValueError mock_isdir.return_value = True mock_walk.return_value = [ ( 'root', ['dir1', 'dir2'], ['foo.py', 'bar.txt'], ), ] conf = mock.MagicMock(print=True) run( mock.sentinel.path, mock.sentinel.config, conf, ) mock_run_importanize.assert_called_once_with( os.path.join('root', 'foo.py'), mock.sentinel.config, conf, ) mock_parser.error.assert_called_once_with(mock.ANY)
def test_run_single_file(self, mock_isdir, mock_run_importanize): mock_isdir.return_value = False run( mock.sentinel.path, mock.sentinel.config, mock.sentinel.args, ) mock_run_importanize.assert_called_once_with( mock.sentinel.path, mock.sentinel.config, mock.sentinel.args, )
def test_run_single_file_exception(self, mock_isdir, mock_run_importanize, mock_parser): mock_isdir.return_value = False mock_run_importanize.side_effect = ValueError run( mock.sentinel.path, mock.sentinel.config, mock.sentinel.args, ) mock_run_importanize.assert_called_once_with( mock.sentinel.path, mock.sentinel.config, mock.sentinel.args, ) mock_parser.error.assert_called_once_with(mock.ANY)
def test_run_folder(self, mock_isdir, mock_walk, mock_run_importanize): mock_isdir.return_value = True mock_walk.return_value = [ ( 'root', ['dir1', 'dir2'], ['foo.py', 'bar.txt'], ), ] conf = mock.MagicMock(print=True) run( mock.sentinel.path, mock.sentinel.config, conf, ) mock_run_importanize.assert_called_once_with( os.path.join('root', 'foo.py'), mock.sentinel.config, conf, )