mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
32 lines
969 B
Python
32 lines
969 B
Python
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License. See LICENSE in the project root
|
|
# for license information.
|
|
|
|
import os.path
|
|
import sys
|
|
|
|
import ptvsd.compat
|
|
|
|
|
|
def get_test_root(name):
|
|
tests_dir = os.path.dirname(os.path.dirname(__file__))
|
|
p = os.path.join(tests_dir, 'func', 'testfiles', name)
|
|
if os.path.exists(p):
|
|
return p
|
|
return None
|
|
|
|
|
|
def compare_path(left, right, show=True):
|
|
# If there's a unicode/bytes mismatch, make both unicode.
|
|
if isinstance(left, ptvsd.compat.unicode):
|
|
if not isinstance(right, ptvsd.compat.unicode):
|
|
right = right.decode(sys.getfilesystemencoding())
|
|
elif isinstance(right, ptvsd.compat.unicode):
|
|
left = right.decode(sys.getfilesystemencoding())
|
|
|
|
n_left = os.path.normcase(left)
|
|
n_right = os.path.normcase(right)
|
|
if show:
|
|
print('LEFT : ' + n_left)
|
|
print('RIGHT: ' + n_right)
|
|
return n_left == n_right
|