On 02:41 pm, olemis at gmail.com wrote: >On Thu, Feb 11, 2010 at 7:41 AM, Michael Foord ><fuzzyman at 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. Jean-Paul
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4