Add a unit test utility function for building a SCMClient.

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

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.

Summary ID
Add a unit test utility function for building a SCMClient.
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.
7ede2bc7f9df52e3755b56dfc5903e234af9c825
david
  1. Ship It!
  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.x (c15a8ff)
Loading...