From c34685316ac4fab1fcb6b9163100b0f8ccd666b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Krassowski?= <5832902+krassowski@users.noreply.github.com> Date: Wed, 29 Jul 2020 23:05:26 +0100 Subject: [PATCH 1/3] Fix tests/mypy error for "not WIN" condition --- py_src/jupyter_lsp/tests/test_paths.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py_src/jupyter_lsp/tests/test_paths.py b/py_src/jupyter_lsp/tests/test_paths.py index a115ae840..3305a77dd 100644 --- a/py_src/jupyter_lsp/tests/test_paths.py +++ b/py_src/jupyter_lsp/tests/test_paths.py @@ -32,7 +32,7 @@ def test_normalize_posix_path_home_subdir( assert normalized_uri(root_dir) == expected_root_uri -@pytest.mark.skipif(~WIN, reason="can't test Windows paths on POSIX") +@pytest.mark.skipif(not WIN, reason="can't test Windows paths on POSIX") @pytest.mark.parametrize( "root_dir, expected_root_uri", [ @@ -58,7 +58,7 @@ def test_file_uri_to_path_posix(file_uri, expected_posix_path): # pragma: no co assert file_uri_to_path(file_uri) == expected_posix_path -@pytest.mark.skipif(~WIN, reason="can't test Windows paths on POSIX") +@pytest.mark.skipif(not WIN, reason="can't test Windows paths on POSIX") @pytest.mark.parametrize( "file_uri, expected_windows_path", [ From f1ad919ff29b218855d3ad11dff028fc9195ff45 Mon Sep 17 00:00:00 2001 From: krassowski Date: Thu, 30 Jul 2020 01:31:51 +0100 Subject: [PATCH 2/3] Update expectations on Windows paths tests, see #305 --- py_src/jupyter_lsp/tests/test_paths.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/py_src/jupyter_lsp/tests/test_paths.py b/py_src/jupyter_lsp/tests/test_paths.py index 3305a77dd..e48e6a5ee 100644 --- a/py_src/jupyter_lsp/tests/test_paths.py +++ b/py_src/jupyter_lsp/tests/test_paths.py @@ -38,7 +38,7 @@ def test_normalize_posix_path_home_subdir( [ ["c:\\Users\\user1", "file:///c:/Users/user1"], ["C:\\Users\\user1", "file:///c:/Users/user1"], - ["//VBOXSVR/shared-folder", "file://vboxsvr/shared-folder"], + ["//VBOXSVR/shared-folder", "file://vboxsvr/shared-folder/"], ], ) def test_normalize_windows_path_case(root_dir, expected_root_uri): # pragma: no cover @@ -62,8 +62,9 @@ def test_file_uri_to_path_posix(file_uri, expected_posix_path): # pragma: no co @pytest.mark.parametrize( "file_uri, expected_windows_path", [ - ["file:///C:/Windows/System32/Drivers/etc", r"C:\Windows\System32\Drivers\etc"], - ["file:///C:/some%20dir/some%20file.txt", r"C:\some dir\some file.txt"], + # see https://github.com/krassowski/jupyterlab-lsp/pull/305#issuecomment-665996145 + ["file:///C:/Windows/System32/Drivers/etc", r"C:/Windows/System32/Drivers/etc"], + ["file:///C:/some%20dir/some%20file.txt", r"C:/some dir/some file.txt"], ], ) def test_file_uri_to_path_windows(file_uri, expected_windows_path): # pragma: no cover From a86e362939d4107a693a8ef9acd549c6cff6eaad Mon Sep 17 00:00:00 2001 From: krassowski Date: Thu, 30 Jul 2020 12:31:23 +0100 Subject: [PATCH 3/3] Remove r prefix, shorten long line with a link --- py_src/jupyter_lsp/tests/test_paths.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py_src/jupyter_lsp/tests/test_paths.py b/py_src/jupyter_lsp/tests/test_paths.py index e48e6a5ee..0a0a8d0f7 100644 --- a/py_src/jupyter_lsp/tests/test_paths.py +++ b/py_src/jupyter_lsp/tests/test_paths.py @@ -62,9 +62,9 @@ def test_file_uri_to_path_posix(file_uri, expected_posix_path): # pragma: no co @pytest.mark.parametrize( "file_uri, expected_windows_path", [ - # see https://github.com/krassowski/jupyterlab-lsp/pull/305#issuecomment-665996145 - ["file:///C:/Windows/System32/Drivers/etc", r"C:/Windows/System32/Drivers/etc"], - ["file:///C:/some%20dir/some%20file.txt", r"C:/some dir/some file.txt"], + # https://github.com/krassowski/jupyterlab-lsp/pull/305#issuecomment-665996145 + ["file:///C:/Windows/System32/Drivers/etc", "C:/Windows/System32/Drivers/etc"], + ["file:///C:/some%20dir/some%20file.txt", "C:/some dir/some file.txt"], ], ) def test_file_uri_to_path_windows(file_uri, expected_windows_path): # pragma: no cover