On Thu, Feb 11, 2010 at 10:10 AM, <exar...@twistedmatrix.com> wrote: > On 02:41 pm, ole...@gmail.com wrote: >> >> On Thu, Feb 11, 2010 at 7:41 AM, Michael Foord >> <fuzzy...@voidspace.org.uk> wrote: >>> >>> On 11/02/2010 12:30, Nick Coghlan wrote: >>>> >>>> Michael Foord wrote: >>>>> >>>>> I'm not sure what response I expect from this email, and neither option >>>>> will be implemented without further discussion - possibly at the PyCon >>>>> sprints - but I thought I would make it clear what the possible >>>>> directions are. >>>> >>>> I'll repeat what I said in the python-ideas thread [1]: with the advent >>>> of PEP 343 and context managers, I see any further extension of the >>>> JUnit inspired setUp/tearDown nomenclature as an undesirable direction >>>> for Python to take. >>>> >>>> Instead, I believe unittest should be adjusted to allow appropriate >>>> definition of context managers that take effect at the level of the test >>>> module, test class and each individual test. >>>> >>>> For example, given the following method definitions in unittest.TestCase >>>> for backwards compatibility: >>>> >>>> def __enter__(self): >>>> self.setUp() >>>> >>>> def __exit__(self, *args): >>>> self.tearDown() >>>> >>>> The test framework might promise to do the following for each test: >>>> >>>> with get_module_cm(test_instance): # However identified >>>> with get_class_cm(test_instance): # However identified >>>> with test_instance: # ** >>>> test_instance.test_method() >>> >> >> What Nick pointed out is the right direction (IMHO), and the one I had > > Why? Change for the sake of change is not a good thing. What are the > advantages of switching to context managers for this? > > Perhaps the idea was more strongly justified in the python-ideas thread. > Anyone have a link to that? >> >> in mind since I realized that unittest extensibility is the key >> feature that needs to be implemented . I even wanted to start a >> project using this particular architecture to make PyUnit extensible. > > What makes you think it isn't extensible now? Lots of people are extending > it in lots of ways. >
Nothing I want to spend my time on. Just consider what the authors of JUnit (and XUnit too) thought about JUnit<4.7, what they did in JUnit 4.7, and you'll save me a lot of time I don't have to explain it to you (/me not being rude /me have no time :-/ ) -- Regards, Olemis. Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: Nabble - Trac Users - Embedding pages? - http://feedproxy.google.com/~r/TracGViz-full/~3/MWT7MJBi08w/Embedding-pages--td27358804.html _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com