mirror of
https://github.com/beetbox/beets.git
synced 2025-12-08 09:34:23 +01:00
Improved the case sensitivity detection test.
This commit is contained in:
parent
58ddecf7af
commit
42f99999f2
1 changed files with 29 additions and 11 deletions
|
|
@ -508,18 +508,36 @@ class PathQueryTest(_common.LibTestCase, TestHelper, AssertsMixin):
|
||||||
results = self.lib.items(makeq(case_sensitive=False))
|
results = self.lib.items(makeq(case_sensitive=False))
|
||||||
self.assert_items_matched(results, ['path item', 'caps path'])
|
self.assert_items_matched(results, ['path item', 'caps path'])
|
||||||
|
|
||||||
# test platform-aware default sensitivity
|
# Check for correct case sensitivity selection (this check
|
||||||
self.patcher_exists.stop()
|
# only works for non-windows os)
|
||||||
try:
|
with _common.system_mock('Darwin'):
|
||||||
with _common.system_mock('Darwin'):
|
# exists = True and samefile = True => Case insensitive
|
||||||
q = makeq()
|
q = makeq()
|
||||||
self.assertEqual(q.case_sensitive, True)
|
self.assertEqual(q.case_sensitive, False)
|
||||||
|
|
||||||
with _common.system_mock('Windows'):
|
self.patcher_samefile.stop()
|
||||||
q = makeq()
|
self.patcher_samefile.start().return_value = False
|
||||||
self.assertEqual(q.case_sensitive, False)
|
|
||||||
finally:
|
# exists = True and samefile = False => Case sensitive
|
||||||
self.patcher_exists.start()
|
q = makeq()
|
||||||
|
self.assertEqual(q.case_sensitive, True)
|
||||||
|
|
||||||
|
self.patcher_samefile.stop()
|
||||||
|
self.patcher_samefile.start().return_value = True
|
||||||
|
|
||||||
|
# test platform-aware default sensitivity when the library
|
||||||
|
# path does not exist (exist = False)
|
||||||
|
self.patcher_exists.stop()
|
||||||
|
self.patcher_exists.start().return_value = False
|
||||||
|
with _common.system_mock('Darwin'):
|
||||||
|
q = makeq()
|
||||||
|
self.assertEqual(q.case_sensitive, True)
|
||||||
|
|
||||||
|
with _common.system_mock('Windows'):
|
||||||
|
q = makeq()
|
||||||
|
self.assertEqual(q.case_sensitive, False)
|
||||||
|
self.patcher_exists.stop()
|
||||||
|
self.patcher_exists.start().return_value = True
|
||||||
|
|
||||||
@patch('beets.library.os')
|
@patch('beets.library.os')
|
||||||
def test_path_sep_detection(self, mock_os):
|
def test_path_sep_detection(self, mock_os):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue