def test_rmtree(tmpdir): dirpath = tmpdir.join("foo") dirpath.ensure(dir=1) _rmtree(dirpath.strpath) assert not dirpath.check()
def test_rmtree_other_error(tmpdir, monkeypatch): def permdenied(_): raise OSError(errno.EPERM, "permission denied") monkeypatch.setattr(shutil, "rmtree", permdenied) _rmtree(tmpdir.strpath)
def test_rmtree_nonexistent(tmpdir): _rmtree(tmpdir.join("foobar").strpath)