From 613d1dbc87d9af5d07dc277f0264d6fe1e2e073b Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 6 Jan 2012 02:18:22 +0000 Subject: Adds workaround check for mox in to_primitive * Works around bug 852095 * Can be removed if a consistent mox 5.4 is released Change-Id: I3e57b60886a94c5e7a337b73716759c9a6838e04 --- nova/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nova/utils.py b/nova/utils.py index efefc5fd1..3d2f901a8 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -41,6 +41,7 @@ from eventlet import event from eventlet import greenthread from eventlet import semaphore from eventlet.green import subprocess +import mox import netaddr from nova import exception @@ -689,6 +690,12 @@ def to_primitive(value, convert_instances=False, level=0): if test(value): return unicode(value) + # NOTE(vish): Workaround for LP bug 852095. Without this workaround, + # tests that raise an exception in a mocked method that + # has a @wrap_exception with a notifier will fail. + if isinstance(value, mox.MockAnything): + return 'mock' + if level > 3: return '?' -- cgit