From 4cda2c36d0ded7d8ae6ba840c7cd5ed3a69f3ee1 Mon Sep 17 00:00:00 2001 From: Ryan Clary Date: Thu, 18 Mar 2021 19:32:59 -0700 Subject: [PATCH] * update test --- spyder/app/tests/test_mainwindow.py | 4 ++-- spyder/plugins/ipythonconsole/utils/kernelspec.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py index af8694d73b3..ee8a5482332 100644 --- a/spyder/app/tests/test_mainwindow.py +++ b/spyder/app/tests/test_mainwindow.py @@ -2627,7 +2627,7 @@ def test_preferences_change_interpreter(qtbot, main_window): config = lsp.generate_python_config() jedi = config['configurations']['pyls']['plugins']['jedi'] assert jedi['environment'] is None - assert jedi['extra_paths'] == [] + assert jedi['extra_paths'] == os.environ.get('PYTHONPATH', '').split(os.pathsep) # Change main interpreter on preferences dlg, index, page = preferences_dialog_helper(qtbot, main_window, @@ -2642,7 +2642,7 @@ def test_preferences_change_interpreter(qtbot, main_window): config = lsp.generate_python_config() jedi = config['configurations']['pyls']['plugins']['jedi'] assert jedi['environment'] == sys.executable - assert jedi['extra_paths'] == [] + assert jedi['extra_paths'] == os.environ.get('PYTHONPATH', '').split(os.pathsep) @pytest.mark.slow diff --git a/spyder/plugins/ipythonconsole/utils/kernelspec.py b/spyder/plugins/ipythonconsole/utils/kernelspec.py index dc070bad873..918936ebc3c 100644 --- a/spyder/plugins/ipythonconsole/utils/kernelspec.py +++ b/spyder/plugins/ipythonconsole/utils/kernelspec.py @@ -134,10 +134,13 @@ def env(self): repo_path = osp.normpath(osp.join(HERE, '..', '..', '..', '..')) subrepo_path = osp.join(repo_path, 'external-deps', 'spyder-kernels') - pythonpath = env_vars.get('PYTHONPATH', '') if DEV else '' - env_vars.update( - {'PYTHONPATH': os.pathsep.join([subrepo_path, pythonpath])} - ) + sys_pythonpath = env_vars.get('PYTHONPATH', '') + if DEV and sys_pythonpath: + # If DEV, don't clobber PYTHONPATH + pythonpath = os.pathsep.join([subrepo_path, sys_pythonpath]) + else: + pythonpath = subrepo_path + env_vars.update({'PYTHONPATH': pythonpath}) # App considerations if (running_in_mac_app() or is_pynsist()):