Comparison tests: helpers for the `do_rpc` pattern
In recent comparison tests, we often use this pattern:
- store stubs in a
dict
with VCS as keys (hg
andgit
) - provide a
do_rpc
nested function that takes avcs
parameter and calls HGitaly or Gitaly according to it, using the stubsdict
, perhaps performing conversions (changeset SHAs) in request or response.
This allows us to conclude many tests with something like assert do_rpc('hg', ...) == do_rpc('git', ...)
It would be great if we had a helper to do this more readily, as it would help to really focus on the current test case, but care must be taken not to make it an additional layer of obscurity.
Edited by Georges Racinet