Update base SCMClient testing for typing and dependency checks.

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

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.

Commits

Files

    Loading...