[libvirt] [test-API PATCH 1/3] utils: Add exception for general test errors

Peter Krempa pkrempa at redhat.com
Tue Apr 3 13:20:44 UTC 2012


This helper exception helps with reporting test errors that don't
produce a libvirt exception. Eg. comparison of returned and expected
value fails although the api call succeeded.
---
 utils/Python/testError.py |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 utils/Python/testError.py

diff --git a/utils/Python/testError.py b/utils/Python/testError.py
new file mode 100644
index 0000000..8e7c44f
--- /dev/null
+++ b/utils/Python/testError.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#
+# libvirt-test-API is copyright 2010 Red Hat, Inc.
+#
+# libvirt-test-API is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version. This program is distributed in
+# the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+# even the implied warranties of TITLE, NON-INFRINGEMENT,
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# The GPL text is available in the file COPYING that accompanies this
+# distribution and at <http://www.gnu.org/licenses>.
+#
+# Filename: testError.py
+# Summary: internal test error exception
+# Description: An exception to signalize test failures that are
+#              separate from libvirt errors
+
+class TestError(Exception):
+    def __init__(self, msg=""):
+        self.msg=msg
+
+    def __str__(self):
+        return self.msg
-- 
1.7.3.4




More information about the libvir-list mailing list