示例#1
0
def test_with(BASE):
    p = PathPlus(BASE)
    it = p.iterdir()
    it2 = p.iterdir()
    next(it2)
    with p:
        pass

    # Using a path as a context manager is a no-op, thus the following
    # operations should still succeed after the context manage exits.
    next(it)
    next(it2)
    p.exists()
    p.resolve()
    p.absolute()
    with p:
        pass
示例#2
0
def test_rmdir(BASE):
    p = PathPlus(BASE) / "dirA"
    for q in p.iterdir():
        q.unlink()
    p.rmdir()
    with pytest.raises(FileNotFoundError):
        p.stat()
    with pytest.raises(FileNotFoundError):
        p.unlink()