[issue9315] The trace module lacks unit tests

Alexander Belopolsky report at bugs.python.org
Mon Jul 26 05:47:24 CEST 2010

Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

I will defer to your judgement on the level of "whiteness" that is appropriate.

I have passed your patch through 2to3, replaced test_support with support and it looks like we have a test case for a regression in 3.x:

FAIL: test_loop_caller_importing (__main__.TestCallers)
Traceback (most recent call last):
  File "Lib/test/test_trace.py", line 203, in test_loop_caller_importing
    self.assertEqual(self.tr.results().callers, expected)
AssertionError: {(('/Users/sasha/Work/python-svn/py3k-commit/Lib/trace.py', 'trace', 'runfunc'), [truncated]... != {(('Lib/test/test_trace.py', 'test_trace', '_traced_func_importing'), ('fakefile [truncated]...
Diff is 973 characters long. Set self.maxDiff to None to see it.


I am attaching a py3k patch.  Let's decide how to proceed.  I would like to commit 3.x and 2.x versions at the same time.   Ideally together with fixes for 3.x bugs.  Another approach would be to temporarily disable failing tests in 3.x, but that would make merging between branches more difficult.

A few more nitpicks:

1. There is no need to use leading or trailing underscores in function or variable names.

2. It would make code more readable if you use longer name for the Trace instance: 'trace' or 'tracer' instead of 'tr'.

3. Your file seems to have white space issues.  Please run "make patchcheck".

4. This may be gratuitous, but I would rather see "func" instead of "foo" and testmodule, testfile, etc. instead of fake*.

Added file: http://bugs.python.org/file18207/issue9315.1-py3k.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list