summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hatina <phatina@redhat.com>2014-05-21 14:44:40 +0200
committerPeter Hatina <phatina@redhat.com>2014-05-21 14:44:54 +0200
commitecf69a1b59c0e26d02ddc1bce881b23760aa5852 (patch)
treefef65b8152031c837913e1a2395bb6b6b9a8d490
parenta8f8e578d9287ccd54f991a7387b6f299be90305 (diff)
downloadopenlmi-providers-ecf69a1b59c0e26d02ddc1bce881b23760aa5852.tar.gz
openlmi-providers-ecf69a1b59c0e26d02ddc1bce881b23760aa5852.tar.xz
openlmi-providers-ecf69a1b59c0e26d02ddc1bce881b23760aa5852.zip
test lmi: use only one connection for test-case
Use the same pattern in LmiTestCase.conn as CIMTestCase.wbemconnection. This saves the time and network bandwidth and also prepares test suite for lmiwbem module, where we could potentially run out of file descriptors range.
-rw-r--r--src/python/lmi/test/lmibase.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/python/lmi/test/lmibase.py b/src/python/lmi/test/lmibase.py
index 53b61c8..7f997d8 100644
--- a/src/python/lmi/test/lmibase.py
+++ b/src/python/lmi/test/lmibase.py
@@ -82,6 +82,8 @@ class LmiTestCase(base.BaseLmiTestCase):
_SYSTEM_INAME = None
+ _LMICONNECTION = None
+
@classmethod
def needs_indications(cls):
"""
@@ -112,7 +114,7 @@ class LmiTestCase(base.BaseLmiTestCase):
abstraction.
:rtype: :py:class:`lmi.shell.LMIConnection`
"""
- if not hasattr(self, '_shellconnection'):
+ if LmiTestCase._LMICONNECTION is None:
kwargs = {}
con_argspec = inspect.getargspec(connect)
# support older versions of lmi shell
@@ -122,9 +124,9 @@ class LmiTestCase(base.BaseLmiTestCase):
elif 'verify_certificate' in con_argspec.args:
# older one
kwargs['verify_certificate'] = False
- self._shellconnection = connect(
+ LmiTestCase._LMICONNECTION = connect(
self.url, self.username, self.password, **kwargs)
- return self._shellconnection
+ return LmiTestCase._LMICONNECTION
@property
def ns(self):