[RFC PATCH 02/13] tests: use os.path.join/normpath for portable path assertions
Adrian Neftali Sanchez <[email protected]>
| Newsgroups | org.kernel.linux.tools |
|---|---|
| Message-ID | <[email protected]> |
Hardcoded forward-slash separators in path suffix checks fail on Windows, where os.sep is a backslash. Replace the literal string comparisons with os.path.join and os.path.normpath so the assertions hold on all platforms. Signed-off-by: Adrian Neftali Sanchez <[email protected]> --- src/tests/test_review_tracking.py | 2 +- src/tests/test_three_way_merge.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/test_review_tracking.py b/src/tests/test_review_tracking.py index 290c991..7d34951 100644 --- a/src/tests/test_review_tracking.py +++ b/src/tests/test_review_tracking.py @@ -23,7 +23,7 @@ class TestGetReviewDataDir: """Verify the review data directory is created.""" reviewdir = review_tracking.get_review_data_dir() assert os.path.isdir(reviewdir) - assert reviewdir.endswith('b4/review') + assert reviewdir.endswith(os.path.join('b4', 'review')) class TestDbOperations: diff --git a/src/tests/test_three_way_merge.py b/src/tests/test_three_way_merge.py index 2b4391e..9982075 100644 --- a/src/tests/test_three_way_merge.py +++ b/src/tests/test_three_way_merge.py @@ -556,7 +556,7 @@ class TestLoadShazamState: 'origin': 'https://example.com', 'merge_flags': '--signoff', } - assert sf == state_file + assert os.path.normpath(sf) == os.path.normpath(state_file) finally: os.unlink(state_file) os.rmdir(patches_dir) -- 2.45.0.windows.1