File tree Expand file tree Collapse file tree 4 files changed +30
-3
lines changed
python_packages/jupyter_lsp/jupyter_lsp Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 11## Changelog
22
3+ ### ` jupyter-lsp 2.2.5 `
4+
5+ - bug fixes:
6+ - fix for environment variables leaking into the parent environment (#1078 )
7+
38### ` jupyter-lsp 2.2.4 `
49
510- bug fixes:
Original file line number Diff line number Diff line change 11""" single source of truth for jupyter_lsp version
22"""
33
4- __version__ = "2.2.4 "
4+ __version__ = "2.2.5 "
Original file line number Diff line number Diff line change 66import os
77import string
88import subprocess
9- from copy import copy
109from datetime import datetime , timezone
1110
1211from tornado .ioloop import IOLoop
@@ -161,7 +160,7 @@ def init_writer(self):
161160 )
162161
163162 def substitute_env (self , env , base ):
164- final_env = copy (os . environ )
163+ final_env = base . copy ()
165164
166165 for key , value in env .items ():
167166 final_env .update ({key : string .Template (value ).safe_substitute (base )})
Original file line number Diff line number Diff line change 11import asyncio
2+ import os
23
34import pytest
45
@@ -100,3 +101,25 @@ async def test_ping(handlers):
100101 assert ws_handler ._ping_sent is True
101102
102103 ws_handler .on_close ()
104+
105+
106+ @pytest .mark .asyncio
107+ async def test_substitute_env (handlers ):
108+ """should not leak environment variables"""
109+ a_server = "pylsp"
110+
111+ handler , ws_handler = handlers
112+ manager = handler .manager
113+
114+ manager .initialize ()
115+
116+ await assert_status_set (handler , {"not_started" })
117+
118+ await ws_handler .open (a_server )
119+ session = manager .sessions [ws_handler .language_server ]
120+ new_env = session .substitute_env ({"test-variable" : "value" }, os .environ )
121+
122+ assert "test-variable" in new_env
123+ assert "test-variable" not in os .environ
124+
125+ ws_handler .on_close ()
You can’t perform that action at this time.
0 commit comments