[Python-Dev] Question over splitting unittest into a package (original) (raw)

Olemis Lang olemis at gmail.com
Wed Dec 30 21:33:43 CET 2009


On Wed, Dec 30, 2009 at 3:04 PM, Benjamin Peterson <benjamin at python.org> wrote:

2009/12/30 Martin (gzlist) <gzlist at 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 isrelevanttblevel(self, tb):  _return 'unittest' in tb.tbframe.fglobals After: <http://svn.python.org/view/python/trunk/Lib/unittest/init.py?revision=74095&view=markup>  def isrelevanttblevel(self, tb):  globs = tb.tbframe.fglobals  _isrelevant =  'name' in globs and _  globs["name"].startswith("unittest")  del globs  return isrelevant

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 isrelevanttblevel 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 _unittestignoretraceback?

Hmmm ... One of the issues I didn't notice ...

IMO +1 for leaving it as it was before (i.e. __unittest) because :

+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-unittest-27-api-new.html



More information about the Python-Dev mailing list