Skip to content

Commit 85e352c

Browse files
committed
format_path
1 parent 62f21bc commit 85e352c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/cli/lookup_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,13 @@ def test_platform_lookup_path(tmpdir):
392392
env['PATH'] = path
393393
exitcode, stdout, stderr, _ = cppcheck_ex(args=['--debug-lookup=platform', '--platform=avr8.xml', test_file], cppcheck_exe=cppcheck, cwd=str(tmpdir), env=env)
394394
assert exitcode == 0, stdout if stdout else stderr
395+
def format_path(p):
396+
return p.replace('\\', '/').replace('"', '\'')
395397
def try_fail(f):
396-
f = f.replace('\\', '/').replace('"', '\'')
398+
f = format_path(f)
397399
return "try to load platform file '{}' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}".format(f, f)
398400
def try_success(f):
399-
f = f.replace('\\', '/').replace('"', '\'')
401+
f = format_path(f)
400402
return "try to load platform file '{}' ... Success".format(f)
401403
lines = stdout.replace('\\', '/').replace('"', '\'').splitlines()
402404
assert lines == [
@@ -405,7 +407,7 @@ def try_success(f):
405407
try_fail(os.path.join(tmpdir, 'platforms', 'avr8.xml')),
406408
try_fail(os.path.join(path, 'avr8.xml')),
407409
try_success(os.path.join(path, 'platforms', 'avr8.xml')),
408-
'Checking {} ...'.format(test_file)
410+
'Checking {} ...'.format(format_path(test_file))
409411
]
410412

411413

0 commit comments

Comments
 (0)