summaryrefslogtreecommitdiffstats
path: root/src/python
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2014-01-08 16:14:48 +0100
committerMichal Minar <miminar@redhat.com>2014-01-08 16:18:52 +0100
commitac94d901a2a1b9fc8683b44adeec2d3d6f9fa5bb (patch)
tree1f4acbcfdec2ad17710eb9f1386aae169861bc73 /src/python
parent73091488aceebd8e49483fa24270688903797080 (diff)
downloadopenlmi-providers-ac94d901a2a1b9fc8683b44adeec2d3d6f9fa5bb.tar.gz
openlmi-providers-ac94d901a2a1b9fc8683b44adeec2d3d6f9fa5bb.tar.xz
openlmi-providers-ac94d901a2a1b9fc8683b44adeec2d3d6f9fa5bb.zip
tests: ensure the use of exceptions is well defined
Some tests expect that exceptions won't be thrown out of LMIShell's functions. Others prefers them and enable them globally. This causes problems when running under nosetests all provider tests at once. Tests that modified enablement of exception throws globally caused others to fail. This patch makes sure that each TestCase has defined use of exceptions. Default state is to have them disabled. If a TestCase prefers having them enabled, just one variable needs to be overriden in its body: class AccountBase(lmibase.LmiTestCase): USE_EXCEPTIONS = True
Diffstat (limited to 'src/python')
-rw-r--r--src/python/lmi/test/lmibase.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/python/lmi/test/lmibase.py b/src/python/lmi/test/lmibase.py
index 242c002..d01c647 100644
--- a/src/python/lmi/test/lmibase.py
+++ b/src/python/lmi/test/lmibase.py
@@ -74,6 +74,12 @@ class LmiTestCase(base.BaseLmiTestCase):
#: it wants to test indication events.
NEEDS_INDICATIONS = False
+ #: Says, whether the LMIShell intestines shall throw exception upon
+ #: failure or error. Having them disabled is a default behaviour of
+ #: LMIShell. If the TestCase prefers to have them enabled, it shall
+ #: override this property in its body and set it to ``True``.
+ USE_EXCEPTIONS = False
+
_SYSTEM_INAME = None
@classmethod
@@ -88,6 +94,7 @@ class LmiTestCase(base.BaseLmiTestCase):
@classmethod
def setUpClass(cls):
base.BaseLmiTestCase.setUpClass.im_func(cls)
+ LMIUtil.lmi_set_use_exceptions(cls.USE_EXCEPTIONS)
if cls.needs_indications():
cls.indication_port = random.randint(12000, 13000)
cls.indication_queue = Queue.Queue()