Fix an exception in the unit test mock framework

Signed-off-by: James Ren <[email protected]>

--- autotest/client/common_lib/test_utils/mock.py       2010-05-13 
15:02:36.000000000 -0700
+++ autotest/client/common_lib/test_utils/mock.py       2010-05-13 
15:02:37.000000000 -0700
@@ -517,7 +517,10 @@
                 print '\nPlayback errors:'
             for error in self.errors:
                 print >> sys.__stdout__, error
-            self._ut.fail('\n'.join(self.errors))
+
+            if self._ut:
+                self._ut.fail('\n'.join(self.errors))
+
             raise CheckPlaybackError
         elif len(self.recording) != 0:
             errors = []
@@ -525,7 +528,10 @@
                 error = "%s not called" % (func_call,)
                 errors.append(error)
                 print >> sys.__stdout__, error
-            self._ut.fail('\n'.join(errors))
+
+            if self._ut:
+                self._ut.fail('\n'.join(errors))
+
             raise CheckPlaybackError
         self.recording.clear()
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to