How to get python nose test function source code in customized plugin?

72 views Asked by At

I have a python nose test function

def test_foo():
    a = 1
    b = 2

and I want to get the source code as string("\ta = 1\n\tb =2") in my customized plugin. I try

def startTest(self, test):
    print inspect.getsource(test)

Above code cannot work. How to make it work?

0

There are 0 answers