据我所知,有一种方法可以在运行时运行测试的名称和参数,使用PyTest with fixture' request':
def test_example(request):
print 'name: %s' % request.node.name
print 'params: %s' % request.node.funcargs
有没有办法从静态上下文中获取相同的信息? 我试图编写一个能够返回相同信息的静态方法:
def static_method():
if not RandomPytestClass.context:
return None
return RandomPytestClass.context.running_test_name, RandomPytestClass.context.running_test_params