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))
def test_remove_files(self, mock_remove): path = '/path/to/remove' shell.remove(path) mock_remove.assert_called_with(path)
def test_remove_directories(self, mock_rmtree): path = '/path/to/remove' shell.remove(path) mock_rmtree.assert_called_with(path, ignore_errors=True)
def test_remove_converts_pathlib_paths(self, mock_convert): path = Path('/path/to/remove') shell.remove(path) mock_convert.assert_called_with(path)