~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rules.py

  • Committer: Ian Clatworthy
  • Date: 2008-06-25 11:22:03 UTC
  • mto: (3515.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3516.
  • Revision ID: ian.clatworthy@canonical.com-20080625112203-4gu1q0lqmxobmfzw
add namespace for rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.util.configobj import configobj
28
28
 
29
29
 
 
30
def _patch_in_namespace(lines):
 
31
    lines_with_prefix = []
 
32
    if lines:
 
33
        for line in lines:
 
34
            if line.startswith('['):
 
35
                line = '[%s%s' % (rules.FILE_PREFS_PREFIX, line[1:])
 
36
            lines_with_prefix.append(line)
 
37
    return lines_with_prefix
 
38
 
 
39
 
30
40
class TestIniBasedRulesSearcher(tests.TestCase):
31
41
 
32
42
    def make_searcher(self, lines):
33
43
        """Make a _RulesSearcher from a list of strings"""
34
 
        return rules._IniBasedRulesSearcher(lines)
 
44
        return rules._IniBasedRulesSearcher(_patch_in_namespace(lines))
35
45
 
36
46
    def test_get_items_file_missing(self):
37
47
        rs = self.make_searcher(None)
75
85
        """Make a _StackedRulesSearcher with 0, 1 or 2 items"""
76
86
        searchers = []
77
87
        if lines1 is not None:
78
 
            searchers.append(rules._IniBasedRulesSearcher(lines1))
 
88
            searchers.append(rules._IniBasedRulesSearcher(
 
89
                _patch_in_namespace(lines1)))
79
90
        if lines2 is not None:
80
 
            searchers.append(rules._IniBasedRulesSearcher(lines2))
 
91
            searchers.append(rules._IniBasedRulesSearcher(
 
92
                _patch_in_namespace(lines2)))
81
93
        return rules._StackedRulesSearcher(searchers)
82
94
 
83
95
    def test_stack_searching(self):