Add a unit test utility function for building a SCMClient.
Review Request #12501 — Created Aug. 5, 2022 and submitted — Latest diff uploaded
This introduces a
SCMClientTestCase.scmclient_cls
attribute and
SCMClientTestCase.build_client()
method. Together, this enables unit
tests to easily and consistently build aSCMClient
instance for
testing.Upcoming changes will begin migrating unit tests away from creating
clients insetUp()
, and instead move them into the individual tests.There are a couple of reasons for this:
1)
SCMClient
setup is soon going to become a two-stage process. First,
initialization, and then a call tosetup()
. Some tests will need to
run with that second stage, and some will need to run without it. We
don't want to have to construct these more than once per test.2) We already are constructing more than once per test in some cases,
when we provide other arguments to the client constructor.Right now,
build_client()
supports taking parsed command line options
and arbitrarySCMClient
constructor parameters. Soon, it will be
updated to take additional flags for controlling setup. Some test suites
may also wrapbuild_client()
to provide more specific setup.
Unit tests pass, but this is currently not used.
Tested this with some upcoming unit test work.