tests: relax check_proj_consistency url checks on windows

The test_import_project*() cases in test_project.py are failing on
windows for reasons that are irrelevant and ultimately down to path
comparisons not being canonicalized for that platform.

Rather than fix tests I don't really think are broken, check if the
expected URL is an actual directory and fall back on PurePath
comparisons instead.

Keep the behavior the same for macOS and Linux.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-02-05 11:51:33 -08:00 committed by Marti Bolivar
parent a0f390ab23
commit 1a9721b062
1 changed files with 7 additions and 3 deletions

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
import os
from pathlib import PurePath
from pathlib import Path, PurePath
import platform
import shlex
import shutil
@ -41,6 +41,8 @@ manifest:
WEST_SKIP_SLOW_TESTS = bool(int(os.environ.get('WEST_SKIP_SLOW_TESTS', 1)))
WINDOWS = (platform.system() == 'Windows')
#
# Test fixtures
#
@ -226,7 +228,7 @@ def cmd(cmd, cwd=None, stderr=None, env=None):
# a python subprocess so that program-level setup and teardown
# happen fresh.
cmd = 'west ' + cmd
if platform.system() != 'Windows':
if not WINDOWS:
cmd = shlex.split(cmd)
print('running:', cmd)
if env:
@ -369,7 +371,9 @@ def check_proj_consistency(actual, expected):
assert a_abs == e_abs
assert a_psx == e_psx
assert actual.url == expected.url
assert (actual.url == expected.url or
(WINDOWS and Path(expected.url).is_dir() and
(PurePath(actual.url) == PurePath(expected.url))))
assert actual.clone_depth == expected.clone_depth
assert actual.revision == expected.revision
assert actual.west_commands == expected.west_commands