diff options
author | David Robillard <d@drobilla.net> | 2018-01-04 14:06:24 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-01-04 19:34:53 -0500 |
commit | 254db2b87025e06693e3f8b17e6c7a5363c2d416 (patch) | |
tree | 85efe6947ba428124f8febcd4f587b81eae48409 | |
parent | 982e8327a07c5da2eda2798ac184779bf3f8d2c7 (diff) | |
download | serd-254db2b87025e06693e3f8b17e6c7a5363c2d416.tar.gz serd-254db2b87025e06693e3f8b17e6c7a5363c2d416.tar.bz2 serd-254db2b87025e06693e3f8b17e6c7a5363c2d416.zip |
Fix file URI to path conversion in test suite on Windows
-rw-r--r-- | wscript | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -291,6 +291,16 @@ def test_thru(ctx, base, path, check_filename, flags, isyntax, osyntax, else: Logs.pprint('RED', 'FAIL: error running %s' % command) +def file_uri_to_path(uri): + try: + from urlparse import urlparse # Python 2 + except: + from urllib.parse import urlparse # Python 3 + + path = urlparse(uri).path + drive = os.path.splitdrive(path[1:])[0] + return path if not drive else path[1:] + def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''): import itertools @@ -355,7 +365,8 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''): result = run_test(command, expected_return, action) if (mf + 'result') in model[test]: # Check output against test suite - check_path = model[test][mf + 'result'][0][len('file://'):] + check_uri = model[test][mf + 'result'][0] + check_path = file_uri_to_path(check_uri) result = autowaf.run_test( ctx, APPNAME, lambda: check_output(action + '.out', check_path), |