Skip to content

Commit

Permalink
Add a test against issue #1076
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Apr 9, 2024
1 parent 71c8e0c commit fe96fc4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions python_packages/jupyter_lsp/jupyter_lsp/tests/test_session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import os

import pytest

Expand Down Expand Up @@ -100,3 +101,23 @@ async def test_ping(handlers):
assert ws_handler._ping_sent is True

ws_handler.on_close()


@pytest.mark.asyncio
async def test_substitute_env(known_server, handlers, jsonrpc_init_msg):
"""should not leak environment variables"""
handler, ws_handler = handlers
manager = handler.manager

manager.initialize()

await assert_status_set(handler, {"not_started"})

await ws_handler.open(known_server)
session = manager.sessions[ws_handler.language_server]
new_env = session.substitute_env({"test-variable": "value"}, os.environ)

assert "test-variable" in new_env
assert "test-variable" not in os.environ

ws_handler.on_close()

0 comments on commit fe96fc4

Please sign in to comment.