From ecf69a1b59c0e26d02ddc1bce881b23760aa5852 Mon Sep 17 00:00:00 2001 From: Peter Hatina Date: Wed, 21 May 2014 14:44:40 +0200 Subject: 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. --- src/python/lmi/test/lmibase.py | 8 +++++--- 1 file 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): -- cgit