(tmp_path)
| 9 | |
| 10 | @mock.patch.dict(os.environ, {}, clear=True) |
| 11 | def 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) |
nothing calls this directly
no outgoing calls
no test coverage detected