****tracefile.py***
import trace,sys
from file1 import call1
#specify what to trace here
tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix], trace=0, count=1)
tracer.runfunc(call1) #call the function call1 in fille1
results = tracer.results()
results.write_results(summary=True, coverdir='.')
为了知道哪个文件正在调用哪个文件,您可以使用跟踪模块
如果你有两个文件
你可以使用控制台:
或者在程序中使用跟踪对象
相关问题 更多 >
编程相关推荐