/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: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

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
from io import BytesIO
 
20
import os
 
21
 
19
22
from .. import (
20
 
    config,
 
23
    bedding,
21
24
    ignores,
22
25
    )
23
 
from ..sixish import (
24
 
    BytesIO,
25
 
    )
26
26
from . import (
27
27
    TestCase,
28
28
    TestCaseInTempDir,
76
76
 
77
77
    def test_create_if_missing(self):
78
78
        # $HOME should be set to '.'
79
 
        ignore_path = config.user_ignore_config_filename()
 
79
        ignore_path = bedding.user_ignore_config_path()
80
80
        self.assertPathDoesNotExist(ignore_path)
81
81
        user_ignores = ignores.get_user_ignores()
82
82
        self.assertEqual(set(ignores.USER_DEFAULTS), user_ignores)
86
86
            entries = ignores.parse_ignore_file(f)
87
87
        self.assertEqual(set(ignores.USER_DEFAULTS), entries)
88
88
 
 
89
    def test_create_with_intermediate_missing(self):
 
90
        # $HOME should be set to '.'
 
91
        ignore_path = bedding.user_ignore_config_path()
 
92
        self.assertPathDoesNotExist(ignore_path)
 
93
        os.mkdir('empty-home')
 
94
 
 
95
        config_path = os.path.join(
 
96
            self.test_dir, 'empty-home', 'foo', '.config')
 
97
        self.overrideEnv('BRZ_HOME', config_path)
 
98
        self.assertPathDoesNotExist(config_path)
 
99
 
 
100
        user_ignores = ignores.get_user_ignores()
 
101
        self.assertEqual(set(ignores.USER_DEFAULTS), user_ignores)
 
102
 
 
103
        ignore_path = bedding.user_ignore_config_path()
 
104
        self.assertPathDoesNotExist(ignore_path)
 
105
 
89
106
    def test_use_existing(self):
90
107
        patterns = [u'*.o', u'*.py[co]', u'\xe5*']
91
108
        ignores._set_user_ignores(patterns)
95
112
 
96
113
    def test_use_empty(self):
97
114
        ignores._set_user_ignores([])
98
 
        ignore_path = config.user_ignore_config_filename()
 
115
        ignore_path = bedding.user_ignore_config_path()
99
116
        self.check_file_contents(ignore_path, b'')
100
117
 
101
118
        self.assertEqual(set([]), ignores.get_user_ignores())