MCPcopy Create free account
hub / github.com/theskumar/python-dotenv / test_ipython_existing_variable_no_override

Function test_ipython_existing_variable_no_override

tests/test_ipython.py:11–23  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

9
10@mock.patch.dict(os.environ, {}, clear=True)
11def test_ipython_existing_variable_no_override(tmp_path):
12 from IPython.terminal.embed import InteractiveShellEmbed
13
14 dotenv_file = tmp_path / ".env"
15 dotenv_file.write_text("a=b\n")
16 os.chdir(str(tmp_path))
17 os.environ["a"] = "c"
18
19 ipshell = InteractiveShellEmbed()
20 ipshell.run_line_magic("load_ext", "dotenv")
21 ipshell.run_line_magic("dotenv", "")
22
23 assert os.environ == {"a": "c"}
24
25
26@mock.patch.dict(os.environ, {}, clear=True)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected