Skip to content

Fix tests/mypy error for "not WIN" condition #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions py_src/jupyter_lsp/tests/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ 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",
[
["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
Expand All @@ -58,12 +58,13 @@ 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",
[
["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
Expand Down