Skip to content

Commit

Permalink
test run with multiple envs
Browse files Browse the repository at this point in the history
  • Loading branch information
duarte-pompeu committed Dec 8, 2023
1 parent c52dd9e commit 9e3df30
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,24 @@ def test_run_with_other_env(dotenv_path):
assert result == "b\n"


@pytest.mark.parametrize(
"contents,expected_values",
(
(["a=1", "b=2"], {"a": "1", "b": "2"}),
(["b=2", "a=1"], {"a": "1", "b": "2"}),
(["a=1", "a=2"], {"a": "2"}),
)
)
def test_run_with_multiple_envs(contents, expected_values, dotenv_path, extra_dotenv_path):
dotenv_path.write_text(contents[0])
extra_dotenv_path.write_text(contents[1])

for key, value in expected_values.items():
result = sh.dotenv("--file", dotenv_path, '--file', extra_dotenv_path, "run", "printenv", key)

assert result == f"{value}\n"


def test_run_without_cmd(cli):
result = cli.invoke(dotenv_cli, ['run'])

Expand Down

0 comments on commit 9e3df30

Please sign in to comment.