From 1a9721b0621943adcb13b23487b302482b297c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 5 Feb 2020 11:51:33 -0800 Subject: [PATCH] tests: relax check_proj_consistency url checks on windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/conftest.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4729c70..b7d217f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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