Beispiel #1
0
import scratchdir

with scratchdir.ScratchDir() as sd:
    tmp = sd.named(suffix='.txt', prefix='logfile-', delete=False)
    print(tmp.name)
Beispiel #2
0
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)
Beispiel #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)
Beispiel #4
0
import scratchdir

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