derwiki-adroll / mock

Automatically exported from code.google.com/p/mock
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Building Patch Collections #168

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Whenever you need to share the same patches across tests, you end up 
duplicating a lot of the code creating the patches and then calling 
contextlib.nested. Not only that, but the resulting code is syntactically 
jarring. It would be nice if the patches could be collected together and then 
patched all at once.

What is the expected output? What do you see instead?
Right now, multiple patches have to be repeated for each test that uses them. 
It would be nice to treat groups of patches as a single unit and be able to 
easily add more/specialize patches later on.

Please provide any additional information below.
This is a link to a project that implements a potential solution:
https://github.com/jehugaleahsa/multipatch

An improvement to the project above would be to use the new 
contextlib.ExitStack class to manage the lifetimes of the patches. As 
multipatch is implemented now, there is no explicit order in which the patches 
would be released.

Original issue reported on code.google.com by jehugale...@gmail.com on 28 Aug 2012 at 8:56

GoogleCodeExporter commented 9 years ago

Original comment by fuzzyman on 3 Sep 2012 at 8:36

GoogleCodeExporter commented 9 years ago
The project at https://github.com/jehugaleahsa/multipatch was updated to use 
ExitStack and was changed to be both Python 2.x and 3.x compatible.

Original comment by jehugale...@gmail.com on 3 Sep 2012 at 12:01