Allow the diff tools registry to be reset, and reset in one test.

Review Request #12632 — Created Sept. 23, 2022 and submitted — Latest diff uploaded

Information

RBTools
release-4.x

Reviewers

We have a unit test that spies on GNUDiffTool.check_available() to
simulate a result, and this ended up leaking state into other tests,
since instances of diff tools are cached by the registry.

This change implements the ability to reset the registry. This is
currently done in only the one test that leaks state at the moment,
though potentially we'd consider it worthwhile to do this on test
teardown later.

It also changes the caching mechanism used for
BaseSCMClient.get_diff_tool() to just store a local copy on the
instance, as @lru_cache can cause memory leaks when used on class
methods.

Unit tests pass.

Tested this with upcoming changes, which were sensitive to this state
leak.

Commits

Files

    Loading...