3
\=p ã @ s, d Z ddgZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddl
mZ yddlZW n" ek
rž ejZdd„ ZY nX dd „ Zd
d„ ZdZG dd
„ d
ƒZdd„ Zdd„ ZG dd„ dƒZdd„ Zdd„ Zddd„Zdd„ ZG dd„ dƒZdd„ Ze dk�r(eƒ dS ) a· program/module to trace Python program or function execution
Sample use, command line:
trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs
trace.py -t --ignore-dir '$prefix' spam.py eggs
trace.py --trackcalls spam.py eggs
Sample use, programmatically
import sys
# create a Trace object, telling it what to ignore, and whether to
# do tracing or line-counting or both.
tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
trace=0, count=1)
# run the new command using the given tracer
tracer.run('main()')
# make a report, placing output in /tmp
r = tracer.results()
r.write_results(show_missing=True, coverdir="/tmp")
ÚTraceÚCoverageResultsé N)Ú monotonicc C s t jd ƒ d S )N)ÚsysÚsettrace© r r ú/usr/lib64/python3.6/trace.pyÚ_unsettraceE s r c C s t j| ƒ tj| ƒ d S )N)Ú threadingr r )Úfuncr r r Ú _settraceH s
r c C s t jd ƒ tjd ƒ d S )N)r r r
r r r r r L s
z#pragma NO COVERc @ s e Zd Zddd„Zdd„ ZdS )Ú_IgnoreNc C s: |s
t ƒ nt |ƒ| _|sg ndd„ |D ƒ| _ddi| _d S )Nc S s g | ]}t jj|ƒ‘qS r )ÚosÚpathÚnormpath)Ú.0Údr r r ú