Add a unit test utility function for building a SCMClient.

Review Request #12501 — Created Aug. 5, 2022 and submitted — Latest diff uploaded

Information

RBTools
release-4.x

Reviewers

This introduces a SCMClientTestCase.scmclient_cls attribute and
SCMClientTestCase.build_client() method. Together, this enables unit
tests to easily and consistently build a SCMClient instance for
testing.

Upcoming changes will begin migrating unit tests away from creating
clients in setUp(), 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 to setup(). 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 arbitrary SCMClient constructor parameters. Soon, it will be
updated to take additional flags for controlling setup. Some test suites
may also wrap build_client() to provide more specific setup.

Unit tests pass, but this is currently not used.

Tested this with some upcoming unit test work.

Commits

Files

    Loading...