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 1
1
## Changelog
2
2
3
+ ### ` jupyter-lsp 2.2.5 `
4
+
5
+ - bug fixes:
6
+ - fix for environment variables leaking into the parent environment (#1078 )
7
+
3
8
### ` jupyter-lsp 2.2.4 `
4
9
5
10
- bug fixes:
Original file line number Diff line number Diff line change 1
1
""" single source of truth for jupyter_lsp version
2
2
"""
3
3
4
- __version__ = "2.2.4 "
4
+ __version__ = "2.2.5 "
Original file line number Diff line number Diff line change 6
6
import os
7
7
import string
8
8
import subprocess
9
- from copy import copy
10
9
from datetime import datetime , timezone
11
10
12
11
from tornado .ioloop import IOLoop
@@ -161,7 +160,7 @@ def init_writer(self):
161
160
)
162
161
163
162
def substitute_env (self , env , base ):
164
- final_env = copy (os . environ )
163
+ final_env = base . copy ()
165
164
166
165
for key , value in env .items ():
167
166
final_env .update ({key : string .Template (value ).safe_substitute (base )})
Original file line number Diff line number Diff line change 1
1
import asyncio
2
+ import os
2
3
3
4
import pytest
4
5
@@ -100,3 +101,25 @@ async def test_ping(handlers):
100
101
assert ws_handler ._ping_sent is True
101
102
102
103
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