-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support symlinks in parents of the root of the workspace (microsoft/v…
- Loading branch information
1 parent
5ff1763
commit aba7378
Showing
8 changed files
with
335 additions
and
19 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
extensions/positron-python/python_files/tests/pytestadapter/test_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
import pathlib | ||
import tempfile | ||
import os | ||
import sys | ||
|
||
from .helpers import ( # noqa: E402 | ||
TEST_DATA_PATH, | ||
) | ||
|
||
script_dir = pathlib.Path(__file__).parent.parent.parent | ||
sys.path.append(os.fspath(script_dir)) | ||
from vscode_pytest import has_symlink_parent # noqa: E402 | ||
|
||
|
||
def test_has_symlink_parent_with_symlink(): | ||
# Create a temporary directory and a file in it | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
file_path = pathlib.Path(temp_dir) / "file" | ||
file_path.touch() | ||
|
||
# Create a symbolic link to the temporary directory | ||
symlink_path = pathlib.Path(temp_dir) / "symlink" | ||
symlink_path.symlink_to(temp_dir) | ||
|
||
# Check that has_symlink_parent correctly identifies the symbolic link | ||
assert has_symlink_parent(symlink_path / "file") | ||
|
||
|
||
def test_has_symlink_parent_without_symlink(): | ||
folder_path = TEST_DATA_PATH / "unittest_folder" / "test_add.py" | ||
# Check that has_symlink_parent correctly identifies that there are no symbolic links | ||
assert not has_symlink_parent(folder_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.