From 7d68a15b20798d07951f3b0161bcfe9b1c5d9b5b Mon Sep 17 00:00:00 2001 From: Christopher Musselle Date: Tue, 26 Feb 2019 23:58:16 +0000 Subject: [PATCH] Duplicate the test for sanatise to use windows path reference data Also include a skip based on whether system is running windows. --- tests/unit/autojump_utils_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/autojump_utils_test.py b/tests/unit/autojump_utils_test.py index 07f67b3..9da9828 100644 --- a/tests/unit/autojump_utils_test.py +++ b/tests/unit/autojump_utils_test.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import os import sys +import platform import mock import pytest @@ -21,6 +22,7 @@ from autojump_utils import surround_quotes from autojump_utils import take from autojump_utils import unico +is_windows = platform.system() == 'Windows' if is_python3(): os.getcwdu = os.getcwd @@ -80,11 +82,15 @@ def test_surround_quotes_in_bash(_): def test_dont_surround_quotes_not_in_bash(_): assert surround_quotes('foo') == 'foo' - +@pytest.mark.skipif(is_windows, reason='Different reference data for path.') def test_sanitize(): assert sanitize([]) == [] assert sanitize([r'/foo/bar/', r'/']) == [u('/foo/bar'), u('/')] +@pytest.mark.skipif(not is_windows, reason='Different reference data for path.') +def test_sanitize_on_windows(): + assert sanitize([]) == [] + assert sanitize(['C:\\foo\\bar\\', 'C:\\']) == [u('C:\\foo\\bar'), u('C:')] @pytest.mark.skipif(is_python3(), reason='Unicode sucks.') def test_unico():