API

class pact.Pact(msg, timeout_seconds=None)
during(callback, *args, **kwargs)

Calls callback periodically while waiting for the pact to finish

finished

Deprecated. Use poll() or is_finished() instead

get_timeout_exception(exc_info)

Returns exception to be used when wait() times out. Default reraises waiting.TimeoutExpired.

is_finished()

Returns whether or not this pact is finished

lastly(callback, *args, **kwargs)

Calls callback when this pact is finished, after all ‘then’ callbacks

on_timeout(callback, *args, **kwargs)

Calls callback when a wait timeout is encountered

poll()

Checks all predicates to see if we’re finished

then(callback, *args, **kwargs)

Calls callback when this pact is finished

until(predicate, *args, **kwargs)

Adds a callback criterion for the completion of this pact

Parameters:predicate – A callable that should return a True-ish value once the end condition is met

Note

When adding multiple predicates via multiple calls to until(), the pact waits on all of them to be satisfied

wait(**kwargs)

Waits for this pact to finish