Apply scenario to test. :param scenario: A tuple (name, parameters) to apply to the test. The test is cloned, its id adjusted to have (name) after it, and the parameters dict is used to update the new test. :param test: The test to apply the scenario to. This test is unaltere
(scenario, test)
| 1085 | |
| 1086 | |
| 1087 | def apply_scenario(scenario, test): |
| 1088 | """Apply scenario to test. |
| 1089 | :param scenario: A tuple (name, parameters) to apply to the test. The test |
| 1090 | is cloned, its id adjusted to have (name) after it, and the parameters |
| 1091 | dict is used to update the new test. |
| 1092 | :param test: The test to apply the scenario to. This test is unaltered. |
| 1093 | :return: A new test cloned from test, with the scenario applied. |
| 1094 | """ |
| 1095 | name, parameters = scenario |
| 1096 | parameters["scenario_name"] = name |
| 1097 | scenario_suffix = '(' + name + ')' |
| 1098 | newtest = clone_test_with_new_id(test, |
| 1099 | test.id() + scenario_suffix) |
| 1100 | # Replace test description with test scenario name |
| 1101 | test_desc = name |
| 1102 | if test_desc is not None: |
| 1103 | newtest_desc = test_desc |
| 1104 | newtest.shortDescription = (lambda: newtest_desc) |
| 1105 | for key, value in parameters.items(): |
| 1106 | setattr(newtest, key, value) |
| 1107 | return newtest |
| 1108 | |
| 1109 | |
| 1110 | # This method is overridden to catch passed test cases |
nothing calls this directly
no outgoing calls
no test coverage detected