예제 #1
0
    def test_remove_echos_fake_rm_directory_command(self, mock_stdout):
        path = '/path/to/remove'

        shell.remove(path, echo=True)

        self.assertEqual(mock_stdout.getvalue(),
                         '>>> rm -rf {}\n'.format(path))
예제 #2
0
    def test_remove_files(self, mock_remove):
        path = '/path/to/remove'

        shell.remove(path)

        mock_remove.assert_called_with(path)
예제 #3
0
    def test_remove_directories(self, mock_rmtree):
        path = '/path/to/remove'

        shell.remove(path)

        mock_rmtree.assert_called_with(path, ignore_errors=True)
예제 #4
0
    def test_remove_converts_pathlib_paths(self, mock_convert):
        path = Path('/path/to/remove')

        shell.remove(path)

        mock_convert.assert_called_with(path)