mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Some pathutils fixes (#589)
* Fix pathutil tests * Handle IndexError in pathutils
This commit is contained in:
parent
6b20c67794
commit
0be3795eb4
2 changed files with 15 additions and 7 deletions
|
|
@ -54,9 +54,11 @@ class PathUnNormcase(object):
|
|||
else:
|
||||
test_name = [sep + dirs[0]]
|
||||
for d in dirs[1:]:
|
||||
test_name += ["{}[{}]".format(d[: - 1], d[-1])]
|
||||
path = glob(sep.join(test_name))[0]
|
||||
res = glob(sep.join((path, filename)))
|
||||
test_name += ["{}[{}]".format(d[:-1], d[-1])]
|
||||
path = glob(sep.join(test_name))
|
||||
if not path:
|
||||
return name
|
||||
res = glob(sep.join((path[0], filename)))
|
||||
if not res:
|
||||
return name
|
||||
return res[0]
|
||||
|
|
|
|||
|
|
@ -61,9 +61,12 @@ class PathUtilTests(unittest.TestCase):
|
|||
"Windows OS specific test")
|
||||
def test_path_names_uppercase_disabled(self):
|
||||
tool = PathUnNormcase()
|
||||
result = tool.un_normcase(FILENAME.upper())
|
||||
expected = FILENAME.upper()
|
||||
result = tool.un_normcase(expected)
|
||||
|
||||
self.assertEqual(result, FILENAME)
|
||||
# Since path tool is disabled we should get the same
|
||||
# path back
|
||||
self.assertEqual(result, expected)
|
||||
|
||||
@unittest.skipIf(platform.system() != 'Windows',
|
||||
"Windows OS specific test")
|
||||
|
|
@ -78,9 +81,12 @@ class PathUtilTests(unittest.TestCase):
|
|||
"Windows OS specific test")
|
||||
def test_path_names_lowercase_disabled(self):
|
||||
tool = PathUnNormcase()
|
||||
result = tool.un_normcase(FILENAME.lower())
|
||||
expected = FILENAME.lower()
|
||||
result = tool.un_normcase(expected)
|
||||
|
||||
self.assertEqual(result, FILENAME)
|
||||
# Since path tool is disabled we should get the same
|
||||
# path back
|
||||
self.assertEqual(result, expected)
|
||||
|
||||
@unittest.skipIf(platform.system() != 'Windows',
|
||||
"Windows OS specific test")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue