Update base SCMClient testing for typing and dependency checks.

Review Request #12530 — Created Aug. 16, 2022 and submitted

Information

RBTools
release-4.x

Reviewers

This updates SCMClientTestCase in preparation for the new dependency
support and testing for each SCMClient.

SCMClientTestCase now uses generics to ensure that the scmclient_cls
being set will be used as the type for all build_client() results,
fixing type checking so that type checkers can match up calls to the
subclass rather than to BaseSCMClient.

build_client() has been updated to default to calling setup() and to
handle dependency errors. If a dependency error is encountered, the test
will be skipped automatically. This means we won't need to test for the
dependencies in each test suite anymore, simplifying things.

Unit tests can tell build_client() not to run setup(), not to check
for dependencies, and not to skip if encountering a dependency error.
This will aid in testing of the dependency checks themselves.

kgb.SpyAgency is also now part of SCMClientTestCase, as it's needed
to skip dependency checks. It has been removed from all subclasses.

All unit tests pass on Python 3.7-3.11.

Summary ID
Update base SCMClient testing for typing and dependency checks.
This updates `SCMClientTestCase` in preparation for the new dependency support and testing for each SCMClient. `SCMClientTestCase` now uses generics to ensure that the `scmclient_cls` being set will be used as the type for all `build_client()` results, fixing type checking so that type checkers can match up calls to the subclass rather than to `BaseSCMClient`. `build_client()` has been updated to default to calling `setup()` and to handle dependency errors. If a dependency error is encountered, the test will be skipped automatically. This means we won't need to test for the dependencies in each test suite anymore, simplifying things. Unit tests can tell `build_client()` not to run `setup()`, not to check for dependencies, and not to skip if encountering a dependency error. This will aid in testing of the dependency checks themselves. `kgb.SpyAgency` is also now part of `SCMClientTestCase`, as it's needed to skip dependency checks. It has been removed from all subclasses.
dc509a1d4ed982e6cc35617d0e4af65059ef278c
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.x (148cebe)