Fix py34 issues
The Nova project now has clean tox py34 runs with a limited set of the UT. This change set fixes two existing py34 issues and allows py34 to run cleanly. The fixed issues are: - Use the 'builtins' module instead of __builtin__. - Don't log exceptions before they are raised. Change-Id: Ib66e36c54353833b8ec35ff6f34b3cd81d609334
This commit is contained in:
parent
d73c7e60e4
commit
e15ae76064
@ -15,16 +15,22 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from nova import test
|
||||
|
||||
from nova_powervm.virt.powervm import image
|
||||
|
||||
if six.PY2:
|
||||
_BUILTIN = '__builtin__'
|
||||
else:
|
||||
_BUILTIN = 'builtins'
|
||||
|
||||
|
||||
class TestImage(test.TestCase):
|
||||
|
||||
@mock.patch('nova.utils.temporary_chown')
|
||||
@mock.patch('__builtin__.open')
|
||||
@mock.patch(_BUILTIN + '.open')
|
||||
@mock.patch('nova.image.api.API')
|
||||
def test_stream_blockdev_to_glance(self, mock_api, mock_open, mock_chown):
|
||||
mock_open.return_value.__enter__.return_value = 'mock_stream'
|
||||
|
@ -267,7 +267,6 @@ class VMBuilder(object):
|
||||
# Check if this is a valid attribute
|
||||
if key not in self._ATTRS_MAP.keys():
|
||||
exc = exception.InvalidAttribute(attr=key)
|
||||
LOG.exception(exc)
|
||||
raise exc
|
||||
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user