Undocumented
Class |
|
A context manager that will catch certain exceptions and provide an indication they occurred. |
Class | on |
Replace a KeyboardInterrupt with SystemExit(1) |
Class | suppress |
A version of contextlib.suppress with decorator support. |
Function | infer |
Given a URL or filename, infer the compression code for tar. |
Function | null |
A null context suitable to stand in for a meaningful context. |
Function | pushd |
>>> tmp_path = getfixture('tmp_path') >>> with pushd(tmp_path): ... assert os.getcwd() == os.fspath(tmp_path) >>> assert os.getcwd() != os.fspath(tmp_path) |
Function | repo |
Check out the repo indicated by url. |
Function | tarball |
Get a tarball, extract it, change to that directory, yield, then clean up. `runner` is the function to invoke commands. `pushd` is a context manager for changing the directory. |
Function | temp |
Create a temporary directory context. Pass a custom remover to override the removal behavior. |
Given a URL or filename, infer the compression code for tar. >>> infer_compression('http://foo/bar.tar.gz') 'z' >>> infer_compression('http://foo/bar.tgz') 'z' >>> infer_compression('file.bz') 'j' >>> infer_compression('file.xz') 'J'
A null context suitable to stand in for a meaningful context. >>> with null() as value: ... assert value is None
>>> tmp_path = getfixture('tmp_path') >>> with pushd(tmp_path): ... assert os.getcwd() == os.fspath(tmp_path) >>> assert os.getcwd() != os.fspath(tmp_path)
def repo_context(url, branch=None, quiet=True, dest_ctx=temp_dir): (source) ¶
Check out the repo indicated by url. If dest_ctx is supplied, it should be a context manager to yield the target directory for the check out.
def tarball_context(url, target_dir=None, runner=None, pushd=pushd): (source) ¶
Get a tarball, extract it, change to that directory, yield, then clean up. `runner` is the function to invoke commands. `pushd` is a context manager for changing the directory.