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

Davanum Srinivas davanum at gmail.com
Thu Aug 20 00:30:41 UTC 2015


haha :)

-- dims

On Wed, Aug 19, 2015 at 7:59 PM, Sylvain Bauza <sbauza at redhat.com> 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 there is no clear solution on how to provide a compatible
>> import for both python2 and python3:
>>  - either providing a python3 compatible behaviour by using
>> contextlib.ExitStack but that class is not available in Python 2
>>  - or provide contextlib2 for python2 (and thus adding it to the
>> requirements)
>>
>> That sounds really disruptive and blocking as we are close to the
>> FeatureFreeze. Many other users of contextlib.nested are not impacted by
>> the job because it excludes all of them but since the test I'm changing is
>> part of the existing validated tests, that leaves Jenkins -1'ing my change.
>>
>> Of course, a 3rd solution would consist of excluding my updated test from
>> the python3 check but I can hear others yelling at that :-)
>>
>> Ideas appreciated.
>>
>>
> So, I just saw there is actually already a solution for that here:
> https://github.com/openstack/nova/blob/master/nova/test.py#L72-L78
>
> beer_count['dims']++
>
> Thanks,
>
>
> -Sylvain
>>
>> [1]
>> https://review.openstack.org/#/c/199205/18/nova/tests/unit/scheduler/test_rpcapi.py,cm
>>
>>
>> __________________________________________________________________________
>>
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe:
>> OpenStack-dev-request at 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-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
Davanum Srinivas :: https://twitter.com/dims
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150819/9d9d05e9/attachment.html>


More information about the OpenStack-dev mailing list