diff --git a/beets/library.py b/beets/library.py index 9b22fd4df..793e5ca40 100644 --- a/beets/library.py +++ b/beets/library.py @@ -53,8 +53,6 @@ class PathQuery(dbcore.FieldQuery): escape_re = re.compile(r'[\\_%]') escape_char = b'\\' - _is_windows = platform.system() == 'Windows' - def __init__(self, field, pattern, fast=True, case_sensitive=None): """Create a path query. @@ -65,7 +63,7 @@ class PathQuery(dbcore.FieldQuery): # By default, the case sensitivity depends on the platform. if case_sensitive is None: - case_sensitive = not self._is_windows + case_sensitive = platform.system() != 'Windows' self.case_sensitive = case_sensitive # Use a normalized-case pattern for case-insensitive matches. diff --git a/test/test_query.py b/test/test_query.py index ee0f3d0ba..4334488df 100644 --- a/test/test_query.py +++ b/test/test_query.py @@ -18,7 +18,6 @@ from __future__ import (division, absolute_import, print_function, unicode_literals) from functools import partial -from mock import patch from test import _common from test._common import unittest @@ -476,11 +475,11 @@ class PathQueryTest(_common.LibTestCase, TestHelper, AssertsMixin): self.assert_items_matched(results, ['path item', 'caps path']) # test platform-aware default sensitivity - with patch('beets.library.PathQuery._is_windows', False): + with _common.platform_posix(): q = makeq() self.assertEqual(q.case_sensitive, True) - with patch('beets.library.PathQuery._is_windows', True): + with _common.platform_windows(): q = makeq() self.assertEqual(q.case_sensitive, False)