def test_trash_long_folder(): path = create_tree() try: trash(str(path)) assert not path.exists() except PermissionError: pytest.skip("Cannot trash from different partition.") finally: with suppress(OSError): path.parent.unlink()
def test_trash_long_folder(): path = create_tree() parent = os.path.dirname(path) try: trash(path) assert not os.path.exists(path) except PermissionError: pytest.skip("Cannot trash from different partition.") finally: with suppress(OSError): os.remove(parent)
def delete_files(): # Send screenshots to Trash/Recycle Bin after merge for i in range(0, 3): print('File "{}" successfully moved to Trash!'.format(files[i])) trash(screenshot_folder + files[i])