v2.17.0 (#822)
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Hdandria <henri.dandria@mistral.ai> Co-authored-by: Ivana Dunisijevic <ivana.dunisijevic@mistral.ai> Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Mert Unsal <mert.unsal@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
564a14365e
commit
6bedf271ce
223 changed files with 10533 additions and 6947 deletions
|
|
@ -20,7 +20,7 @@ def test_skips_missing_file(tmp_path: Path) -> None:
|
|||
assert environ == {"EXISTING": "1"}
|
||||
|
||||
|
||||
def test_sets_and_overrides_values(tmp_path: Path) -> None:
|
||||
def test_adds_missing_values_without_overriding_existing(tmp_path: Path) -> None:
|
||||
env_path = tmp_path / ".env"
|
||||
_write_env_file(
|
||||
env_path,
|
||||
|
|
@ -42,11 +42,23 @@ def test_sets_and_overrides_values(tmp_path: Path) -> None:
|
|||
|
||||
load_dotenv_values(env_path=env_path, environ=environ)
|
||||
|
||||
assert environ["MISTRAL_API_KEY"] == "new-key"
|
||||
assert environ["HTTPS_PROXY"] == "https://local-proxy:8080"
|
||||
assert environ["OTHER"] == "from-env"
|
||||
# An explicit process/shell value wins over the .env file.
|
||||
assert environ["MISTRAL_API_KEY"] == "old-key"
|
||||
assert environ["HTTPS_PROXY"] == "old-https"
|
||||
assert environ["OTHER"] == "keep"
|
||||
assert environ["FOO"] == "keep"
|
||||
# Keys absent from the process env are still loaded from the .env file.
|
||||
assert environ["NEW_KEY"] == "added"
|
||||
assert environ["FOO"] == "replace"
|
||||
|
||||
|
||||
def test_adds_dotenv_value_when_process_env_is_empty(tmp_path: Path) -> None:
|
||||
env_path = tmp_path / ".env"
|
||||
_write_env_file(env_path, "MISTRAL_API_KEY=file-key\n")
|
||||
environ = {"MISTRAL_API_KEY": ""}
|
||||
|
||||
load_dotenv_values(env_path=env_path, environ=environ)
|
||||
|
||||
assert environ["MISTRAL_API_KEY"] == "file-key"
|
||||
|
||||
|
||||
def test_ignores_empty_values(tmp_path: Path) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue