I noticed after filing this that a seemly related problem had been mentioned in the comments of bug 734145 by Eli, which suggests this may not be a test-only issue?
In which case a general cache cleanup mechanism is needed?
Otherwise, the tests really need to use TestCase.addCleanup within the context test run, it can't really be done from code elsewhere (though the logic can live wherever).
I noticed after filing this that a seemly related problem had been mentioned in the comments of bug 734145 by Eli, which suggests this may not be a test-only issue?
<https:/ /bugs.launchpad .net/bzr- git/+bug/ 734145/ comments/ 14>
In which case a general cache cleanup mechanism is needed?
Otherwise, the tests really need to use TestCase.addCleanup within the context test run, it can't really be done from code elsewhere (though the logic can live wherever).