Merge "Refactor "utils.parse_ini_file" testing"
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Tue, 26 Jun 2018 09:53:14 +0000 (09:53 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Tue, 26 Jun 2018 09:53:14 +0000 (09:53 +0000)
1  2 
yardstick/tests/unit/common/test_utils.py

@@@ -19,8 -19,8 +19,7 @@@ from six.moves import configparse
  import time
  import unittest
  
- import yardstick
  from yardstick import ssh
 -import yardstick.error
  from yardstick.common import constants
  from yardstick.common import utils
  from yardstick.common import exceptions
@@@ -991,8 -1068,16 +1067,8 @@@ class TestUtils(ut_base.BaseUnitTestCas
          with self.assertRaises(RuntimeError):
              utils.validate_non_string_sequence(1, raise_exc=RuntimeError)
  
 -    def test_error_class(self):
 -        with self.assertRaises(RuntimeError):
 -            yardstick.error.ErrorClass()
 -
 -        error_instance = yardstick.error.ErrorClass(test='')
 -        with self.assertRaises(AttributeError):
 -            error_instance.get_name()
 -
  
- class TestUtilsIpAddrMethods(unittest.TestCase):
+ class TestUtilsIpAddrMethods(ut_base.BaseUnitTestCase):
  
      GOOD_IP_V4_ADDRESS_STR_LIST = [
          u'0.0.0.0',
@@@ -1174,19 -1259,8 +1250,19 @@@ class TimerTestCase(ut_base.BaseUnitTes
              with utils.Timer(timeout=1):
                  time.sleep(2)
  
 +    def test__enter_with_timeout_no_exception(self):
 +        with utils.Timer(timeout=1, raise_exception=False):
 +            time.sleep(2)
 +
 +    def test__iter(self):
 +        iterations = []
 +        for i in utils.Timer(timeout=2):
 +            iterations.append(i)
 +            time.sleep(1.1)
 +        self.assertEqual(2, len(iterations))
 +
  
- class WaitUntilTrueTestCase(unittest.TestCase):
+ class WaitUntilTrueTestCase(ut_base.BaseUnitTestCase):
  
      def test_no_timeout(self):
          self.assertIsNone(utils.wait_until_true(lambda: True,