Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_trace.TestRunExecCounts Class Reference

List of all members.

Public Member Functions

def setUp
def test_exec_counts

Public Attributes

 my_py_filename
 tracer

Detailed Description

A simple sanity test of line-counting, via runctx (exec)

Definition at line 191 of file test_trace.py.


Member Function Documentation

Definition at line 193 of file test_trace.py.

00193 
00194     def setUp(self):
00195         self.my_py_filename = fix_ext_py(__file__)

Here is the caller graph for this function:

Definition at line 196 of file test_trace.py.

00196 
00197     def test_exec_counts(self):
00198         self.tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0)
00199         code = r'''traced_func_loop(2, 5)'''
00200         code = compile(code, __file__, 'exec')
00201         self.tracer.runctx(code, globals(), vars())
00202 
00203         firstlineno = get_firstlineno(traced_func_loop)
00204         expected = {
00205             (self.my_py_filename, firstlineno + 1): 1,
00206             (self.my_py_filename, firstlineno + 2): 6,
00207             (self.my_py_filename, firstlineno + 3): 5,
00208             (self.my_py_filename, firstlineno + 4): 1,
00209         }
00210 
00211         # When used through 'run', some other spurious counts are produced, like
00212         # the settrace of threading, which we ignore, just making sure that the
00213         # counts fo traced_func_loop were right.
00214         #
00215         for k in expected.keys():
00216             self.assertEqual(self.tracer.results().counts[k], expected[k])
00217 


Member Data Documentation

Definition at line 194 of file test_trace.py.

Definition at line 197 of file test_trace.py.


The documentation for this class was generated from the following file: