如何在pytest bdd中将参数从WHEN传递到THEN?
例如,如果我有以下代码:
@when('is a number divisible by 10') def n1_is_a_number_divisible_by_10(n1): assert (n1 % 10) == 0 newN1 = n1/10 return newN1 @then('the result will also be divisible by 3') def the_result_will_also_be_divisible_by_3(newN1): assert newN1 % 3 == 0
如何将newN1从when传递到then?
(我尝试过将newN1设置为全局变量...虽然可以,但是在python中通常不赞成将其设置为全局)。