def test_move_path_to_trash_couldnt(): from conda.gateways.disk.delete import move_path_to_trash with tempdir() as td: test_path = join(td, 'test_path') touch(test_path) _try_open(test_path) assert isdir(td) assert isfile(test_path) assert move_path_to_trash(test_path)
def test_backoff_unlink(): from conda.gateways.disk.delete import backoff_rmdir with tempdir() as td: test_path = join(td, 'test_path') touch(test_path) _try_open(test_path) assert isdir(td) backoff_rmdir(td) assert not isdir(td)
def test_move_to_trash(): with tempdir() as td: test_path = join(td, 'test_path') touch(test_path) _try_open(test_path) assert isdir(td) assert isfile(test_path) move_to_trash(td, test_path) assert not isfile(test_path)
def test_remove_file_to_trash(): with tempdir() as td: test_path = join(td, 'test_path') touch(test_path) assert isfile(test_path) _try_open(test_path) _make_read_only(test_path) pytest.raises((IOError, OSError), _try_open, test_path) assert rm_rf(test_path) assert not isfile(test_path)
def test_remove_dir(): with tempdir() as td: test_path = join(td, 'test_path') touch(test_path) _try_open(test_path) assert isfile(test_path) assert isdir(td) assert not islink(test_path) assert rm_rf(td) assert rm_rf(test_path) assert not isdir(td) assert not isfile(test_path) assert not lexists(test_path)