~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ignores.py

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
 
19
19
from cStringIO import StringIO
20
20
 
21
 
from bzrlib import config, errors, ignores
22
 
from bzrlib.tests import TestCase, TestCaseInTempDir, TestCaseWithTransport
 
21
from bzrlib import (
 
22
    config,
 
23
    ignores,
 
24
    )
 
25
from bzrlib.tests import (
 
26
    TestCase,
 
27
    TestCaseInTempDir,
 
28
    TestCaseWithTransport,
 
29
    )
23
30
 
24
31
 
25
32
class TestParseIgnoreFile(TestCase):
69
76
    def test_create_if_missing(self):
70
77
        # $HOME should be set to '.'
71
78
        ignore_path = config.user_ignore_config_filename()
72
 
        self.failIfExists(ignore_path)
 
79
        self.assertPathDoesNotExist(ignore_path)
73
80
        user_ignores = ignores.get_user_ignores()
74
81
        self.assertEqual(set(ignores.USER_DEFAULTS), user_ignores)
75
82
 
76
 
        self.failUnlessExists(ignore_path)
 
83
        self.assertPathExists(ignore_path)
77
84
        f = open(ignore_path, 'rb')
78
85
        try:
79
86
            entries = ignores.parse_ignore_file(f)
142
149
class TestRuntimeIgnores(TestCase):
143
150
 
144
151
    def setUp(self):
145
 
        TestCase.setUp(self)
 
152
        super(TestRuntimeIgnores, self).setUp()
146
153
 
147
154
        # For the purposes of these tests, we must have no
148
155
        # runtime ignores
168
175
    
169
176
    def assertPatternsEquals(self, patterns):
170
177
        contents = open(".bzrignore", 'rU').read().strip().split('\n')
171
 
        self.assertEquals(sorted(patterns), sorted(contents))
 
178
        self.assertEqual(sorted(patterns), sorted(contents))
172
179
 
173
180
    def test_new_file(self):
174
181
        tree = self.make_branch_and_tree(".")
215
222
        self.build_tree_contents([('.bzrignore', "myentry1\r\n")])
216
223
        tree.add([".bzrignore"])
217
224
        ignores.tree_ignores_add_patterns(tree, ["myentry2", "foo"])
218
 
        self.assertEquals(open('.bzrignore', 'rb').read(), 'myentry1\r\nmyentry2\r\nfoo\r\n')
 
225
        self.assertEqual(open('.bzrignore', 'rb').read(), 'myentry1\r\nmyentry2\r\nfoo\r\n')
219
226
        self.assertPatternsEquals(["myentry1", "myentry2", "foo"])