mardi 5 avril 2016

Getting pytest name and parameters from context during runtime

As I know there is a way to get running test's name and parameters during runtime using PyTest with fixture 'request':

def test_example(request):
   print 'name: %s' % request.node.name
   print 'params: %s' % request.node.funcargs

Is there a way to get the same information from static context? I'm trying to write a static method that will be able to return the same info:

def static_method():
   if not RandomPytestClass.context:
      return None
   return RandomPytestClass.context.running_test_name, RandomPytestClass.context.running_test_params

Aucun commentaire:

Enregistrer un commentaire