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

Olemis Lang olemis at gmail.com
Thu Jan 7 19:24:59 CET 2010


On Mon, Jan 4, 2010 at 9:24 AM, Olemis Lang <olemis at gmail.com> wrote:

On Thu, Dec 31, 2009 at 10:30 AM, Martin (gzlist) <gzlist at googlemail.com> wrote:

Thanks for the quick response.

On 30/12/2009, Benjamin Peterson <benjamin at python.org> wrote: but maybe a discussion could start about a new, less hacky, way of doing the same I am strongly -1 for modifying the classes in «traditional» unittest module [2] (except that I am strongly +1 for the package structure WITHOUT TOUCHING anything else ...) , and the more I think about it I am more convinced ... but anyway, this not a big deal (and in the end what I think is not that relevant either ... :o). So ...

IOW, if I had all the freedom to implement it, after the pkg structure I'd do something like :

{{{ #!python

class TestResult: # Everything just the same def _is_relevant_tb_level(self, tb): return '__unittest' in tb.tb_frame.f_globals

class BetterTestResult(TestResult): # Further code ... maybe ;o) # def _is_relevant_tb_level(self, tb): # This or anything else you might want to do ;o) # globs = tb.tb_frame.f_globals is_relevant = 'name' in globs and
globs["name"].startswith("unittest") del globs return is_relevant }}}

that's what inheritance is for ;o) ... but quite probably that's not gonna happen, just a comment .

-- Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/

Featured article: Ubuntu sustituye GIMP por F-Spot - http://feedproxy.google.com/r/simelo-es/3/-g48D6T6Ojs/ubuntu-sustituye-gimp-por-f-spot.html



More information about the Python-Dev mailing list