/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_ignores.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for handling of ignore files"""
18
18
 
19
 
import os
20
 
 
21
19
from .. import (
22
 
    bedding,
 
20
    config,
23
21
    ignores,
24
22
    )
25
23
from ..sixish import (
78
76
 
79
77
    def test_create_if_missing(self):
80
78
        # $HOME should be set to '.'
81
 
        ignore_path = bedding.user_ignore_config_path()
 
79
        ignore_path = config.user_ignore_config_filename()
82
80
        self.assertPathDoesNotExist(ignore_path)
83
81
        user_ignores = ignores.get_user_ignores()
84
82
        self.assertEqual(set(ignores.USER_DEFAULTS), user_ignores)
88
86
            entries = ignores.parse_ignore_file(f)
89
87
        self.assertEqual(set(ignores.USER_DEFAULTS), entries)
90
88
 
91
 
    def test_create_with_intermediate_missing(self):
92
 
        # $HOME should be set to '.'
93
 
        ignore_path = bedding.user_ignore_config_path()
94
 
        self.assertPathDoesNotExist(ignore_path)
95
 
        os.mkdir('empty-home')
96
 
 
97
 
        config_path = os.path.join(self.test_dir, 'empty-home', '.config')
98
 
        self.overrideEnv('BRZ_HOME', config_path)
99
 
        self.assertPathDoesNotExist(config_path)
100
 
 
101
 
        user_ignores = ignores.get_user_ignores()
102
 
        self.assertEqual(set(ignores.USER_DEFAULTS), user_ignores)
103
 
 
104
 
        ignore_path = bedding.user_ignore_config_path()
105
 
        self.assertPathDoesNotExist(ignore_path)
106
 
 
107
89
    def test_use_existing(self):
108
90
        patterns = [u'*.o', u'*.py[co]', u'\xe5*']
109
91
        ignores._set_user_ignores(patterns)
113
95
 
114
96
    def test_use_empty(self):
115
97
        ignores._set_user_ignores([])
116
 
        ignore_path = bedding.user_ignore_config_path()
 
98
        ignore_path = config.user_ignore_config_filename()
117
99
        self.check_file_contents(ignore_path, b'')
118
100
 
119
101
        self.assertEqual(set([]), ignores.get_user_ignores())