source | issues

Testing Utilities

additional py.test options

--vcs {name}

limit the testing for backends to the given vcs

--local-remoting

if given also test the local remoting

--no-direct-api

Don’t run the normal local testing, useful for remote-only

pytest funcargs

pytest_funcarg__backend(request)[source]

create a cached backend instance that is used the whole session makes instanciating backend cheap

pytest_funcarg__mgr(request)[source]

create a preconfigured tests.helplers.VcsMan instance pass the currently tested backend and create a tmpdir for the vcs/test combination

auto-check for the vcs features and skip if necessary

pytest_funcarg__repo(request)[source]

create a repo below mgf called ‘repo’

pytest_funcarg__wd(request)[source]

create a workdir below mgr called ‘wd’ if the feature “wd:heavy” is not supported use repo as help

Utility Classes

class VcsMan(vc, base, xspec, backend)[source]

utility class to manage the creation of repositories and workdirs inside of a specific path (usually the tmpdir funcarg of a test)

base
Type :py.path.local

the base directory

vc

The name of the managed vcs

backend
Type :anyvc.backend.Backend

The backend instance giving access to the currently tested vcs

remote

boolean telling if the remoting support is used

xspec

A execnet.XSpec telling remote python if remoting is used

create_wd(workdir, source=None)[source]
Parameters:
  • workdir (str) – name of the target workdir
  • source (repo or None) – name of a source repository

create a workdir if source is given, use it as base

make_repo(name)[source]
Parameters:name – name of the repository to create

create a repository using the given name

class WdWrap(wd)[source]
Parameters:wd (subclass of anyvc.common.workdir.Workdir) – the workdir to wrap

decorator for a vcs workdir instance adds testing utility functions and proxies the other methods/attributes to the real instance

check_states(exact=True, **kw)[source]
Parameters:
  • exact (bool) – if true, ignore additional states
  • $statename (list of relative path) – state name for that particular file list
Returns:

True if all supplied files have the asumed state

delete_files(*relpaths)[source]
Parameters:relpaths – listing of files to remove
has_files(*files)[source]
Parameters:files – a listing of filenames that shsould exist
put_files(mapping)[source]

the text content will be rstripped and get a newline appended