PackageTestHandler

runs test packages via XMLRPC.

a handler designed for SimpleXMLRPCServer .

Example of starting the server:

pkg = TestablePackage(svnpath = 'http://svn.myrepo/')
handler = PackageTestHandler([pkg])
serv = SimpleXMLRPCServer(("localhost", 8000))
serv.register_introspection_functions()
serv.register_instance(handler)
serv.serve_forever()

You send a request to the server and call a method to trigger tests. see trigger_from_svnlook for a concrete example of client/server interaction.

Arguments:

Keyword Arguments:

  • stream -- filelike object for reporter, defaults to sys.stdout
  • notify -- if not empty, results are emailed here
  • tmp_dir -- directory to export into and run tests

Methods

f __init__(self, packages, stream=<open file '<stdout>', mode 'w' at 0x12068>, notify=None, tmp_dir=None) ...

f trigger_from_svnlook(self, svnlook_info, svnlook_changed, revision) ...

analyzes input from svnlook changed and runs tests affected by the change.

this method is designed to support the scenario where your subversion repository is located on one machine but you want to run the tests on another.

A client that calls this from within a subversion post-commit hook might look like this:

from testtools.bgtests import SvnInspector
from xmlrpclib import ServerProxy
meta = SvnInspector(repos_root, revision=revision)
s = ServerProxy('http://%s:%s' % (host, port))
passed = s.trigger_from_svnlook( meta.info(), "\n".join(meta.changed()), revision )

NOTE: the handler assumes the svnlook output is from the same repository that the packages reside in and currently doesn't not support mixing packages that come from different repositories.

returns True if all tests passed (or if none ran), False otherwise.

See the source for more information.