예제 #1
0
    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)
예제 #2
0
 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,
     )
예제 #3
0
 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,
     )
예제 #4
0
 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)
예제 #5
0
 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)
예제 #6
0
    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,
        )
예제 #7
0
    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,
        )
예제 #8
0
    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)