summaryrefslogtreecommitdiff
path: root/tests/test_self.py
diff options
context:
space:
mode:
authorKarthik Nadig <kanadig@microsoft.com>2022-08-09 05:25:47 -0700
committerGitHub <noreply@github.com>2022-08-09 08:25:47 -0400
commit6170086801ce3054e0d020028a5c539de626b757 (patch)
treee73311f0a91b8d5ac6dbd1b295d56a9e97b67b16 /tests/test_self.py
parent684a1d6aa0a6791e20078bc524f97c8906332390 (diff)
downloadpylint-git-6170086801ce3054e0d020028a5c539de626b757.tar.gz
Check for `<cwd>` before removing first item from `sys.path` in `modify_sys_path`. (#7277)
Diffstat (limited to 'tests/test_self.py')
-rw-r--r--tests/test_self.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_self.py b/tests/test_self.py
index 7c11601a9..53c9fb11b 100644
--- a/tests/test_self.py
+++ b/tests/test_self.py
@@ -759,6 +759,24 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
modify_sys_path()
assert sys.path == paths[1:]
+ paths = ["", *default_paths]
+ sys.path = copy(paths)
+ with _test_environ_pythonpath():
+ modify_sys_path()
+ assert sys.path == paths[1:]
+
+ paths = [".", *default_paths]
+ sys.path = copy(paths)
+ with _test_environ_pythonpath():
+ modify_sys_path()
+ assert sys.path == paths[1:]
+
+ paths = ["/do_not_remove", *default_paths]
+ sys.path = copy(paths)
+ with _test_environ_pythonpath():
+ modify_sys_path()
+ assert sys.path == paths
+
paths = [cwd, cwd, *default_paths]
sys.path = copy(paths)
with _test_environ_pythonpath("."):