Add testcase to check that features_set._prune_overrides() is working
authorZac Medico <zmedico@gentoo.org>
Tue, 31 Aug 2010 05:00:44 +0000 (22:00 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 31 Aug 2010 05:00:44 +0000 (22:00 -0700)
correctly.

pym/portage/tests/ebuild/test_config.py

index f48717d4fc86abba5a90cfdf8db5860c55a1e38d..b12605aacdf9b6fc0764904994d08ae4345d4cdf 100644 (file)
@@ -13,7 +13,8 @@ class ConfigTestCase(TestCase):
        def testFeaturesMutation(self):
                """
                Test whether mutation of config.features updates the FEATURES
-               variable and persists through config.regenerate() calls.
+               variable and persists through config.regenerate() calls. Also
+               verify that features_set._prune_overrides() works correctly.
                """
                playground = ResolverPlayground()
                try:
@@ -33,6 +34,12 @@ class ConfigTestCase(TestCase):
                        self.assertEqual('noclean' in settings['FEATURES'].split(), True)
                        settings.regenerate()
                        self.assertEqual('noclean' in settings['FEATURES'].split(),True)
+
+                       # before: ['noclean', '-noclean', 'noclean']
+                       settings.features._prune_overrides()
+                       #  after: ['noclean']
+                       self.assertEqual(settings._features_overrides.count('noclean'), 1)
+                       self.assertEqual(settings._features_overrides.count('-noclean'), 0)
                finally:
                        playground.cleanup()