Comment 2 for bug 1301711

Revision history for this message
Leah Klearman (lklrmn) wrote :

This looks like a probable solution:

    def run(self, result):
        self.sortTests()
        current_resources = set()
        for test in self._tests:
            if result.shouldStop:
                break
            if not getattr(test._get_test_method(), '__unittest_skip__', False):
                resources = getattr(test, 'resources', [])
                new_resources = set()
                for name, resource in resources:
                    new_resources.update(resource.neededResources())
                self.switch(current_resources, new_resources, result)
                current_resources = new_resources
            test(result)
        self.switch(current_resources, set(), result)
        return result