def test_sh_rm_broken_symlink(): with sh.tmpdir(): os.symlink('afile-notexist', 'alink') assert not path.exists('alink') assert path.lexists('alink') sh.rm('alink') assert not path.lexists('alink')
def test_sh_rm_symlink(): with sh.tmpdir(): with open('afile', 'w') as f: f.close() assert path.exists('afile') os.symlink('afile', 'alink') assert path.lexists('alink') sh.rm('alink') assert not path.lexists('alink')
def test_sh_rm_dir(): with sh.tmpdir(): sh.mkdirs('adir') with sh.cd('adir'): with open('afile', 'w') as f: f.close() assert path.exists('afile') assert path.exists('adir') sh.rm('adir') assert not path.exists('adir')
def test_sh_rm_file(): with sh.tmpdir(): with open('afile', 'w') as f: f.close() assert path.exists('afile') sh.rm('afile') assert not path.exists('afile')