Skip to content

Commit

Permalink
remove format param for test_list_multi_file
Browse files Browse the repository at this point in the history
  • Loading branch information
duarte-pompeu committed Dec 8, 2023
1 parent d61c1ed commit 46f1b75
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import sh
from pathlib import Path
from typing import List, Optional
from typing import Dict, List, Optional

import pytest

Expand Down Expand Up @@ -38,27 +38,18 @@ def test_list_single_file(cli, dotenv_path, format: Optional[str], content: str,


@pytest.mark.parametrize(
"format,contents,expected",
"contents,expected",
(
(None, ["x='1'", "y='2'"], '''x=1\ny=2\n'''),
(None, ["x='1'", "x='2'"], '''x=2\n'''),
(None, ["x='1'\ny='2'", "y='20'\nz='30'"], '''x=1\ny=20\nz=30\n'''),
(["x='1'", "y='2'"], '''x=1\ny=2\n'''),
(["x='1'", "x='2'"], '''x=2\n'''),
(["x='1'\ny='2'", "y='20'\nz='30'"], '''x=1\ny=20\nz=30\n'''),
)
)
def test_list_multi_file(
cli,
dotenv_path,
extra_dotenv_path,
format: Optional[str],
contents: List[str],
expected: str
):
def test_list_multi_file(cli, dotenv_path, extra_dotenv_path, contents: List[str], expected: str):
dotenv_path.write_text(contents[0] + '\n')
extra_dotenv_path.write_text(contents[1] + '\n')

args = ['--file', dotenv_path, '--file', extra_dotenv_path, 'list']
if format is not None:
args.extend(['--format', format])

result = cli.invoke(dotenv_cli, args)

Expand Down Expand Up @@ -101,7 +92,13 @@ def test_get_existing_value_single_file(cli, dotenv_path):
(["a=1", "a=2"], {"a": "2"}),
)
)
def test_get_existing_value_multi_file(cli, contents, expected_values, dotenv_path, extra_dotenv_path):
def test_get_existing_value_multi_file(
cli,
dotenv_path,
extra_dotenv_path,
contents: List[str],
expected_values: Dict[str, str]
):
dotenv_path.write_text(contents[0])
extra_dotenv_path.write_text(contents[1])

Expand Down Expand Up @@ -273,7 +270,7 @@ def test_run_with_other_env(dotenv_path):
(["a=1", "a=2"], {"a": "2"}),
)
)
def test_run_with_multiple_envs(contents, expected_values, dotenv_path, extra_dotenv_path):
def test_run_with_multi_envs(dotenv_path, extra_dotenv_path, contents: List[str], expected_values: Dict[str, str]):
dotenv_path.write_text(contents[0])
extra_dotenv_path.write_text(contents[1])

Expand Down

0 comments on commit 46f1b75

Please sign in to comment.