
On Wed, Dec 30, 2009 at 3:04 PM, Benjamin Peterson <benjamin@python.org> wrote:
2009/12/30 Martin (gzlist) <gzlist@googlemail.com>:
Hi Benjamin,
Hi!
In rev 74094 of Python, you split the unittest module up,
+1
could you point me at any bug entries or discussion over this revision so I can catch up?
This was mostly a discussion on IRC between Michael Foord and myself.
... and there was a previous thread about that some time ago here in python-dev ;o)
def _is_relevant_tb_level(self, tb): return '__unittest' in tb.tb_frame.f_globals
After: <http://svn.python.org/view/python/trunk/Lib/unittest/__init__.py?revision=74095&view=markup>
def _is_relevant_tb_level(self, tb): globs = tb.tb_frame.f_globals is_relevant = '__name__' in globs and \ globs["__name__"].startswith("unittest") del globs return is_relevant
Had not seen this ... Hmmm ... -1
Only packages actually named "unittest" can be excluded.
What is now the prefered method of marking a module as test-internal? Overriding the leading-underscore _is_relevant_tb_level method? How can this be done cooperatively by different packages?
When I made that change, I didn't know that the __unittest "hack" was being used elsewhere outside of unittest, so I felt fine replacing it with another. While I still consider it an implementation detail, I would be ok with exposing an "official" API for this. Perhaps __unittest_ignore_traceback?
Hmmm ... One of the issues I didn't notice ... IMO +1 for leaving it as it was before (i.e. __unittest) because : - the double underscore should mean (CMIIW) that it's an implementation detail - not few libs use that name already ;o) +0.5 for adding `__unittest_ignore_traceback` or something shorter (e.g. `__unittest_ignore`) too ... +1 for documenting that «hack» PS: `assertRaises` context managers are great !!! BTW ;o) -- Regards, Olemis. Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: Assessment of unittest 2.7 API : new features and opinions - http://feedproxy.google.com/~r/simelo-en/~3/cVOgG8NIBFY/assessment-of-unitte...