(self)
| 243 | @unittest.skipIf(os.environ.get('PYTHON_UOPS_OPTIMIZE') == '0', |
| 244 | "Line counts differ when JIT optimizer is disabled") |
| 245 | def test_exec_counts(self): |
| 246 | self.tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0) |
| 247 | code = r'''traced_func_loop(2, 5)''' |
| 248 | code = compile(code, __file__, 'exec') |
| 249 | self.tracer.runctx(code, globals(), vars()) |
| 250 | |
| 251 | firstlineno = get_firstlineno(traced_func_loop) |
| 252 | expected = { |
| 253 | (self.my_py_filename, firstlineno + 1): 1, |
| 254 | (self.my_py_filename, firstlineno + 2): 6, |
| 255 | (self.my_py_filename, firstlineno + 3): 5, |
| 256 | (self.my_py_filename, firstlineno + 4): 1, |
| 257 | } |
| 258 | |
| 259 | # When used through 'run', some other spurious counts are produced, like |
| 260 | # the settrace of threading, which we ignore, just making sure that the |
| 261 | # counts fo traced_func_loop were right. |
| 262 | # |
| 263 | for k in expected.keys(): |
| 264 | self.assertEqual(self.tracer.results().counts[k], expected[k]) |
| 265 | |
| 266 | |
| 267 | class TestFuncs(unittest.TestCase): |
nothing calls this directly
no test coverage detected