PICARD-2076: Use Windows long path prefix only, if long paths are unsupported

This commit is contained in:
Philipp Wolfer
2022-03-06 17:40:26 +01:00
parent 5037ce9935
commit 718875177b
4 changed files with 32 additions and 24 deletions

View File

@@ -37,7 +37,10 @@ import re
import subprocess # nosec: B404
from tempfile import NamedTemporaryFile
import unittest
from unittest.mock import Mock
from unittest.mock import (
Mock,
patch,
)
from test.picardtestcase import PicardTestCase
@@ -722,7 +725,9 @@ class NormpathTest(PicardTestCase):
self.assertEqual('C:\\Bar.baz', normpath('C:/Foo/../Bar.baz'))
@unittest.skipUnless(IS_WIN, "windows test")
def test_normpath_windows_longpath(self):
@patch.object(util, 'system_supports_long_paths')
def test_normpath_windows_longpath(self, mock_system_supports_long_paths):
mock_system_supports_long_paths.return_value = False
path = 'C:\\foo\\' + (252 * 'a')
self.assertEqual(path, normpath(path))
path += 'a'