aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 65f28db36..42dc7f937 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -219,11 +219,8 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_filename('_BD_eEpuzXw', is_id=True), '_BD_eEpuzXw')
self.assertEqual(sanitize_filename('N0Y__7-UOdI', is_id=True), 'N0Y__7-UOdI')
+ @unittest.mock.patch('sys.platform', 'win32')
def test_sanitize_path(self):
- with unittest.mock.patch('sys.platform', 'win32'):
- self._test_sanitize_path()
-
- def _test_sanitize_path(self):
self.assertEqual(sanitize_path('abc'), 'abc')
self.assertEqual(sanitize_path('abc/def'), 'abc\\def')
self.assertEqual(sanitize_path('abc\\def'), 'abc\\def')
@@ -254,10 +251,8 @@ class TestUtil(unittest.TestCase):
# Check with nt._path_normpath if available
try:
- import nt
-
- nt_path_normpath = getattr(nt, '_path_normpath', None)
- except Exception:
+ from nt import _path_normpath as nt_path_normpath
+ except ImportError:
nt_path_normpath = None
for test, expected in [