Le 20/08/2015 03:37, John Garbutt a écrit :
On 20 August 2015 at 01:42, melanie witt <melwi...@gmail.com> wrote:
On Aug 19, 2015, at 16:51, Sylvain Bauza <sba...@redhat.com> wrote:

Ideas appreciated.
Instead of using the nested context managers, a way I like is to decorate a 
nested function in the test and call it, for example:


def test_thing(self):

     @mock.patch(...)
     @mock.patch(...)
     @mock.patch(...)
     def do_test(..., ..., ...):
         ...

     do_test()
+1

I have always found that more readable that the context manager thing,
can't really explain why.

Agreed, it looks like a good approach and leave an alternative possibility for not using the test.nested stuff.

-Sylvain

johnthetubaguy

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to