~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ignores.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-20 21:51:21 UTC
  • mto: This revision was merged to the branch mainline in revision 1877.
  • Revision ID: john@arbash-meinel.com-20060720215121-2e15a8db5ad5fac4
Add a function for adding runtime ignores.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
        self.assertEqual(['xxx'], added)
108
108
        self.assertEqual(['foo', './bar', u'b\xe5z', 'xxx'],
109
109
                         ignores.get_user_ignores())
 
110
 
 
111
 
 
112
class TestRuntimeIgnores(TestCase):
 
113
 
 
114
    def setUp(self):
 
115
        TestCase.setUp(self)
 
116
 
 
117
        orig = ignores._runtime_ignores
 
118
        def restore():
 
119
            ignores._runtime_ignores = orig
 
120
        self.addCleanup(restore)
 
121
        # For the purposes of these tests, we must have no
 
122
        # runtime ignores
 
123
        ignores._runtime_ignores = set()
 
124
 
 
125
    def test_add(self):
 
126
        """Test that we can add an entry to the list."""
 
127
        self.assertEqual(set(), ignores.get_runtime_ignores())
 
128
 
 
129
        ignores.add_runtime_ignores(['foo'])
 
130
        self.assertEqual(set(['foo']), ignores.get_runtime_ignores())
 
131
 
 
132
    def test_add_duplicate(self):
 
133
        """Adding the same ignore twice shouldn't add a new entry."""
 
134
        ignores.add_runtime_ignores(['foo', 'bar'])
 
135
        self.assertEqual(set(['foo', 'bar']), ignores.get_runtime_ignores())
 
136
 
 
137
        ignores.add_runtime_ignores(['bar'])
 
138
        self.assertEqual(set(['foo', 'bar']), ignores.get_runtime_ignores())