diff --git a/tests/units/__init__.py b/tests/hardware/__init__.py similarity index 100% rename from tests/units/__init__.py rename to tests/hardware/__init__.py diff --git a/tests/units/test_device_matcher.py b/tests/hardware/test_device_matcher.py similarity index 95% rename from tests/units/test_device_matcher.py rename to tests/hardware/test_device_matcher.py index 14f18d5..d3e879f 100644 --- a/tests/units/test_device_matcher.py +++ b/tests/hardware/test_device_matcher.py @@ -1,5 +1,5 @@ import unittest -from tuned.units.device_matcher import DeviceMatcher +from tuned.hardware.device_matcher import DeviceMatcher class DeviceMatcherTestCase(unittest.TestCase): @classmethod diff --git a/tests/profiles/test_profile.py b/tests/profiles/test_profile.py index 419fb6b..d474781 100644 --- a/tests/profiles/test_profile.py +++ b/tests/profiles/test_profile.py @@ -1,5 +1,6 @@ import unittest import tuned.profiles +import collections class MockProfile(tuned.profiles.profile.Profile): def _create_unit(self, name, config): @@ -17,14 +18,14 @@ class ProfileTestCase(unittest.TestCase): "storage" : { "type": "disk" }, }) - self.assertIs(type(profile.units), list) + self.assertIs(type(profile.units), collections.OrderedDict) self.assertEqual(len(profile.units), 2) self.assertListEqual(sorted(map(lambda (name, config): name, profile.units)), sorted(["network", "storage"])) def test_create_units_empty(self): profile = MockProfile("test", {"main":{}}) - self.assertIs(type(profile.units), list) + self.assertIs(type(profile.units), collections.OrderedDict) self.assertEqual(len(profile.units), 0) def test_sets_name(self): diff --git a/tuned/hardware/device_matcher.py b/tuned/hardware/device_matcher.py index bb3d7a8..8e78ea1 100644 --- a/tuned/hardware/device_matcher.py +++ b/tuned/hardware/device_matcher.py @@ -22,7 +22,7 @@ class DeviceMatcher(object): if isinstance(rules, basestring): rules = re.split(r"\s|,\s*", rules) - positive_rules = filter(lambda rule: not rule.startswith("!"), rules) + positive_rules = filter(lambda rule: not rule.startswith("!") and not rule.strip() == '', rules) negative_rules = [rule[1:] for rule in rules if rule not in positive_rules] if len(positive_rules) == 0: