예제 #1
0
import scratchdir

with scratchdir.ScratchDir() as sd:
    tmp = sd.named(suffix='.txt', prefix='logfile-', delete=False)
    print(tmp.name)
예제 #2
0
파일: tests.py 프로젝트: 42B/scratchdir
def scratch_dir(tmpdir):
    """
    Fixture that yields a :class:`~scratchdir.ScratchDir` instance with a root directory
    that is unique to each test invocation.
    """
    return scratchdir.ScratchDir(root=tmpdir.strpath)
예제 #3
0
import scratchdir

with scratchdir.ScratchDir(prefix='grandparent-') as grandparent:
    print(grandparent.wd)
    with grandparent.child(prefix='parent-') as parent:
        print(parent.wd)
        with parent.child(prefix='child-') as child:
            print(child.wd)
예제 #4
0
파일: setup.py 프로젝트: ahawker/scratchdir
import scratchdir

sd = scratchdir.ScratchDir()
sd.setup()
print(sd.wd)
sd.teardown()