~julian+/testscenarios/testscenarios

« back to all changes in this revision

Viewing changes to lib/testscenarios/scenarios.py

  • Committer: Robert Collins
  • Date: 2010-02-01 04:49:05 UTC
  • mfrom: (12.2.1 testscenarios.devel)
  • Revision ID: robertc@robertcollins.net-20100201044905-e7q9bubgoj2duu63
Merge patch from Ben Finney making tests with a shortDescription have that altered as well as the id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    :param test: The test to apply the scenario to. This test is unaltered.
36
36
    :return: A new test cloned from test, with the scenario applied.
37
37
    """
 
38
    scenario_suffix = '(' + name + ')'
38
39
    newtest = clone_test_with_new_id(test,
39
 
        test.id() + '(' + name + ')')
 
40
        test.id() + scenario_suffix)
 
41
    test_desc = test.shortDescription()
 
42
    if test_desc is not None:
 
43
        newtest_desc = "%(test_desc)s %(scenario_suffix)s" % vars()
 
44
        newtest.shortDescription = (lambda: newtest_desc)
40
45
    for key, value in parameters.iteritems():
41
46
        setattr(newtest, key, value)
42
47
    return newtest