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

Function test_ipython_existing_variable_override

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

Source from the content-addressed store, hash-verified

25
26@mock.patch.dict(os.environ, {}, clear=True)
27def test_ipython_existing_variable_override(tmp_path):
28 from IPython.terminal.embed import InteractiveShellEmbed
29
30 dotenv_file = tmp_path / ".env"
31 dotenv_file.write_text("a=b\n")
32 os.chdir(str(tmp_path))
33 os.environ["a"] = "c"
34
35 ipshell = InteractiveShellEmbed()
36 ipshell.run_line_magic("load_ext", "dotenv")
37 ipshell.run_line_magic("dotenv", "-o")
38
39 assert os.environ == {"a": "b"}
40
41
42@mock.patch.dict(os.environ, {}, clear=True)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected