Use unittest2 module for unittesting
This commit is contained in:
parent
a2ed07c1af
commit
ca040870b3
4 changed files with 9 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import unittest
|
||||
import unittest2
|
||||
import tests.globals
|
||||
import tuned.monitors.base
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ class MockMonitor(tuned.monitors.base.Monitor):
|
|||
cls._load.setdefault(device, 0)
|
||||
cls._load[device] += 1
|
||||
|
||||
class MonitorBaseClassTestCase(unittest.TestCase):
|
||||
class MonitorBaseClassTestCase(unittest2.TestCase):
|
||||
def test_fail_base_class_init(self):
|
||||
with self.assertRaises(NotImplementedError):
|
||||
tuned.monitors.base.Monitor()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import unittest
|
||||
import unittest2
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from tuned.profiles.locator import Locator
|
||||
|
||||
class LocatorTestCase(unittest.TestCase):
|
||||
class LocatorTestCase(unittest2.TestCase):
|
||||
def setUp(self):
|
||||
self.locator = Locator(self._tmp_load_dirs)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import unittest
|
||||
import unittest2
|
||||
import tuned.profiles
|
||||
import collections
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ class MockProfile(tuned.profiles.profile.Profile):
|
|||
def _create_unit(self, name, config):
|
||||
return (name, config)
|
||||
|
||||
class ProfileTestCase(unittest.TestCase):
|
||||
class ProfileTestCase(unittest2.TestCase):
|
||||
|
||||
def test_init(self):
|
||||
MockProfile("test", {})
|
||||
|
|
@ -20,7 +20,7 @@ class ProfileTestCase(unittest.TestCase):
|
|||
|
||||
self.assertIs(type(profile.units), collections.OrderedDict)
|
||||
self.assertEqual(len(profile.units), 2)
|
||||
self.assertListEqual(sorted([name_config[0] for name_config in profile.units]), sorted(["network", "storage"]))
|
||||
self.assertListEqual(sorted([name_config for name_config in profile.units]), sorted(["network", "storage"]))
|
||||
|
||||
def test_create_units_empty(self):
|
||||
profile = MockProfile("test", {"main":{}})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import unittest
|
||||
import unittest2
|
||||
from tuned.profiles import Unit
|
||||
|
||||
class UnitTestCase(unittest.TestCase):
|
||||
class UnitTestCase(unittest2.TestCase):
|
||||
|
||||
def test_default_options(self):
|
||||
unit = Unit("sample", {})
|
||||
|
|
|
|||
Loading…
Reference in a new issue