[issue9315] The trace module lacks unit tests

Eli Bendersky report at bugs.python.org
Mon Jul 26 05:03:39 CEST 2010


Eli Bendersky <eliben at gmail.com> added the comment:

Alexander,

1. Done
2. Done
3. Done. Made docstrings follow PEP 257, to the best of my understanding
4. Done. Attached patch is made on fresh SVN 2.7 branch, file renamed to test_trace.py and 'svn add' executed

5. I'm not sure I agree with you on this point. IMHO, it's taking the "whiteness" of testing a bit too far. I will explain:

The globaltrace and localtrace methods of Trace are quite thin, taking frame information and shoving it into an internal counts dict. To test them a lot of manual construction is required, which is very implementation dependent. In the future, Trace's implementation may be modified, and such tests will have to be completely re-coded as a result. 

At the moment, checking Trace via its 'runfunc' API allows 100% 
coverage on the relevant globaltrace and localtrace functions without getting into implementation details too deep. I think that given this there's no real point in getting deeper. Had I not been able to thoroughly examine their inner workings via runfunc, I would indeed consider getting deeper in the unit tests, but now I just don't really see the point.

----------
Added file: http://bugs.python.org/file18205/test_trace.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9315>
_______________________________________


More information about the Python-bugs-list mailing list