to persist for future config.regenerate() calls.
"""
overrides_set = set(self._settings._features_overrides)
- if len(overrides_set) < len(self._settings._features_overrides):
- positive = set()
- negative = set()
- for x in self._settings._features_overrides:
- if x[:1] == '-':
- positive.discard(x[:1])
- negative.add(x[:1])
- else:
- positive.add(x)
- negative.discard(x)
- self._settings._features_overrides[:] = \
- list(positive) + list(negative)
+ positive = set()
+ negative = set()
+ for x in self._settings._features_overrides:
+ if x[:1] == '-':
+ positive.discard(x[1:])
+ negative.add(x[1:])
+ else:
+ positive.add(x)
+ negative.discard(x)
+ self._settings._features_overrides[:] = \
+ list(positive) + list('-' + x for x in negative)
# after: ['noclean']
self.assertEqual(settings._features_overrides.count('noclean'), 1)
self.assertEqual(settings._features_overrides.count('-noclean'), 0)
+
+ settings.features.remove('noclean')
+
+ # before: ['noclean', '-noclean']
+ settings.features._prune_overrides()
+ # after: ['-noclean']
+ self.assertEqual(settings._features_overrides.count('noclean'), 0)
+ self.assertEqual(settings._features_overrides.count('-noclean'), 1)
finally:
playground.cleanup()