py.test: how to get the current test's name from the setup method?

前端 未结 7 2086
心在旅途
心在旅途 2020-12-17 07:49

I am using py.test and wonder if/how it is possible to retrieve the name of the currently executed test within the setup method that is invoked before running e

相关标签:
7条回答
  • You can also do this using the Request Fixture like this:

    def test_name1(request):
        testname = request.node.name
        assert testname == 'test_name1'
    
    0 讨论(0)
提交回复
热议问题