Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-28 Thread Brant Knudson
On Wed, Aug 19, 2015 at 6:51 PM, Sylvain Bauza wrote: > Hi, > > I was writing some tests so I added a contextlib.nested to a checked > TestCase [1]. Unfortunately, contextlib.nested is no longer available in > Python3 and there is no clear solution on how to provide a compatible > import for both

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-25 Thread Joshua Harlow
On Tue, 25 Aug 2015 12:23:28 -0700 Jay Pipes wrote: > On 08/25/2015 10:17 AM, Joshua Harlow wrote: > > Oh, discard everything I say then :) > > > > My brain must still be partially functioning due to vacation, > > haha. > > import functools > > def work(vacation=False): > if not vacation

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-25 Thread Jay Pipes
On 08/25/2015 10:17 AM, Joshua Harlow wrote: Oh, discard everything I say then :) My brain must still be partially functioning due to vacation, haha. import functools def work(vacation=False): if not vacation: get_lots_done() back_from_vacation = functools.partial(work, vacation=

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-25 Thread Joshua Harlow
On Sun, 23 Aug 2015 18:32:33 -0400 Davanum Srinivas wrote: > Josh, > > the test.nested() in Nova uses exactly that: > http://git.openstack.org/cgit/openstack/nova/tree/nova/test.py#n75 > > -- dims Oh, discard everything I say then :) My brain must still be partially functioning due to vacatio

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-24 Thread Sylvain Bauza
Le 20/08/2015 03:37, John Garbutt a écrit : On 20 August 2015 at 01:42, melanie witt wrote: On Aug 19, 2015, at 16:51, Sylvain Bauza 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:

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-24 Thread Sylvain Bauza
Le 23/08/2015 02:01, Feodor Tersin a écrit : > From: kevin.mitch...@rackspace.com > > Actually, there should no longer be a need to use contextlib.nested. > We've explicitly dropped Python 2.6 compatibility, which means we're > expecting compatibility with Python 2.7+ only, and as of Python 2.7

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-23 Thread Davanum Srinivas
Josh, the test.nested() in Nova uses exactly that: http://git.openstack.org/cgit/openstack/nova/tree/nova/test.py#n75 -- dims On Sun, Aug 23, 2015 at 5:16 PM, Joshua Harlow wrote: > On Fri, 21 Aug 2015 10:39:34 -0500 > "Kevin L. Mitchell" wrote: > > > On Wed, 2015-08-19 at 16:51 -0700, Sylvai

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-23 Thread Joshua Harlow
On Fri, 21 Aug 2015 10:39:34 -0500 "Kevin L. Mitchell" wrote: > On Wed, 2015-08-19 at 16:51 -0700, Sylvain Bauza wrote: > > I was writing some tests so I added a contextlib.nested to a > > checked TestCase [1]. Unfortunately, contextlib.nested is no longer > > available in Python3 and there is no

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-23 Thread Feodor Tersin
> From: kevin.mitch...@rackspace.com > > Actually, there should no longer be a need to use contextlib.nested. > We've explicitly dropped Python 2.6 compatibility, which means we're > expecting compatibility with Python 2.7+ only, and as of Python 2.7, the > 'with' statement supports accepting mult

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-21 Thread Kevin L. Mitchell
On Wed, 2015-08-19 at 16:51 -0700, Sylvain Bauza wrote: > I was writing some tests so I added a contextlib.nested to a checked > TestCase [1]. Unfortunately, contextlib.nested is no longer available in > Python3 and there is no clear solution on how to provide a compatible > import for both pyth

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-20 Thread John Garbutt
On 20 August 2015 at 01:42, melanie witt wrote: > On Aug 19, 2015, at 16:51, Sylvain Bauza 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): > > @m

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-19 Thread melanie witt
On Aug 19, 2015, at 16:51, Sylvain Bauza 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

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-19 Thread Davanum Srinivas
haha :) -- dims On Wed, Aug 19, 2015 at 7:59 PM, Sylvain Bauza wrote: > > > Le 19/08/2015 16:51, Sylvain Bauza a écrit : > >> Hi, >> >> I was writing some tests so I added a contextlib.nested to a checked >> TestCase [1]. Unfortunately, contextlib.nested is no longer available in >> Python3 and

Re: [openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-19 Thread Sylvain Bauza
Le 19/08/2015 16:51, Sylvain Bauza a écrit : Hi, I was writing some tests so I added a contextlib.nested to a checked TestCase [1]. Unfortunately, contextlib.nested is no longer available in Python3 and there is no clear solution on how to provide a compatible import for both python2 and py

[openstack-dev] [nova] contextlib.nested and Python3 failing

2015-08-19 Thread Sylvain Bauza
Hi, I was writing some tests so I added a contextlib.nested to a checked TestCase [1]. Unfortunately, contextlib.nested is no longer available in Python3 and there is no clear solution on how to provide a compatible import for both python2 and python3: - either providing a python3 compatible