diff options
author | Karthik Nadig <kanadig@microsoft.com> | 2022-08-09 05:25:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 08:25:47 -0400 |
commit | 6170086801ce3054e0d020028a5c539de626b757 (patch) | |
tree | e73311f0a91b8d5ac6dbd1b295d56a9e97b67b16 /tests/test_self.py | |
parent | 684a1d6aa0a6791e20078bc524f97c8906332390 (diff) | |
download | pylint-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.py | 18 |
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("."): |