Commit 212aff327a36f925be3be69b9b54b946dbdd5c2a replaced
'cinder.openstack.common.fileutils.file_open' with 'open'
from builtins. It also updated unit tests to patch 'six.
moves.builtins.open' instead of 'cinder.openstack.common.
fileutils.file_open'. This resulted in intermittent failure
of test 'test_create_backing_from_stream_optimized_file'
in VMwareVcVmdkDriverTestCase. The failure happens because
the test patches 'open' from builtins and tests code which
throws an exception in a 'with open(...)' block. This
exception is handled in excutils.save_and_reraise_exception
which uses 'with open(...)' and the exception handling
fails due to the global patching of 'open'.
This patch replaces the global patching of builtins 'open'
with a patch decorator which binds 'open' to the namespace
of the code under testing.
Reviewed: https:/ /review. openstack. org/220438 /git.openstack. org/cgit/ openstack/ cinder/ commit/ ?id=05c2ba2ebc6 041c2e3d3481c18 98a90517d01e5b
Committed: https:/
Submitter: Jenkins
Branch: master
commit 05c2ba2ebc6041c 2e3d3481c1898a9 0517d01e5b
Author: Vipin Balachandran <email address hidden>
Date: Fri Sep 4 13:47:34 2015 +0530
VMware: Remove global patching of open
Commit 212aff327a36f92 5be3be69b9b54b9 46dbdd5c2a replaced openstack. common. fileutils. file_open' with 'open' builtins. open' instead of 'cinder. openstack. common. file_open' . This resulted in intermittent failure backing_ from_stream_ optimized_ file' verTestCase. The failure happens because save_and_ reraise_ exception
'cinder.
from builtins. It also updated unit tests to patch 'six.
moves.
fileutils.
of test 'test_create_
in VMwareVcVmdkDri
the test patches 'open' from builtins and tests code which
throws an exception in a 'with open(...)' block. This
exception is handled in excutils.
which uses 'with open(...)' and the exception handling
fails due to the global patching of 'open'.
This patch replaces the global patching of builtins 'open'
with a patch decorator which binds 'open' to the namespace
of the code under testing.
Closes-bug: #1488690 9111c1bdff6d4b6 fa7568518ca
Change-Id: Ib0f47b8fcbc54a