test scenario adaption (was Re: [MERGE] repository external reference tests (StackedBranches))

Jonathan Lange jml at mumak.net
Wed Jun 11 03:24:50 BST 2008


On Wed, Jun 11, 2008 at 12:04 PM, Martin Pool <mbp at canonical.com> wrote:
> On Wed, Jun 11, 2008 at 11:14 AM, Jonathan Lange <jml at mumak.net> wrote:
>> One thing that confuses me is that TestScenarioApplier has methods for
>> adapting single test case instances, but not test suites. To do that,
>> one must use the adapt_tests function. To have such a distinction
>> between singular and plural seems unnecessary.
>
> No, it has TestScenarioApplier.adapt() which takes a suit.  That name
> could be more explicit.

TSA.adapt passes 'test' directly to adapt_test_to_scenario.

    def adapt_test_to_scenario(self, test, scenario):
        from copy import deepcopy
        new_test = deepcopy(test)
        for name, value in scenario[1].items():
            setattr(new_test, name, value)
        new_id = "%s(%s)" % (new_test.id(), scenario[0])
        ^^^

That ilne fails if 'test' is a suite.

jml



More information about the bazaar mailing list