From 4cf5544e75afd6ab3656665f6afbeb4036c01c48 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 27 Jan 2023 07:17:12 +0000 Subject: [PATCH] Remove unused append_linesep parameter --- .../merge_production_dotenvs_in_dotenv.py | 4 +-- ...test_merge_production_dotenvs_in_dotenv.py | 25 ++++++------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py index 4b416d630..35139fb2e 100644 --- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py @@ -14,13 +14,11 @@ DOTENV_FILE = BASE_DIR / ".env" def merge( output_file: Path, files_to_merge: Sequence[Path], - append_linesep: bool = True, ) -> None: merged_content = "" for merge_file in files_to_merge: merged_content += merge_file.read_text() - if append_linesep: - merged_content += os.linesep + merged_content += os.linesep output_file.write_text(merged_content) diff --git a/{{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py index faf7357f6..c0e68f60a 100644 --- a/{{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/tests/test_merge_production_dotenvs_in_dotenv.py @@ -6,28 +6,19 @@ from merge_production_dotenvs_in_dotenv import merge @pytest.mark.parametrize( - ("input_contents", "append_linesep", "expected_output"), + ("input_contents", "expected_output"), [ - # No line separator - ([], False, ""), - ([""], False, ""), - (["\n"], False, "\n"), - (["TEST=1"], False, "TEST=1"), - (["THIS=2", "THAT='example'"], False, "THIS=2THAT='example'"), - (["ONE=1\n", "TWO=2"], False, "ONE=1\nTWO=2"), - (["A=0", "B=1", "C=2"], False, "A=0B=1C=2"), - # With line separator - ([], True, ""), - ([""], True, "\n"), - (["JANE=doe"], True, "JANE=doe\n"), - (["SEP=true", "AR=ator"], True, "SEP=true\nAR=ator\n"), - (["X=x\n", "Y=y", "Z=z\n"], True, "X=x\n\nY=y\nZ=z\n\n"), + ([], ""), + ([""], "\n"), + (["JANE=doe"], "JANE=doe\n"), + (["SEP=true", "AR=ator"], "SEP=true\nAR=ator\n"), + (["A=0", "B=1", "C=2"], "A=0\nB=1\nC=2\n"), + (["X=x\n", "Y=y", "Z=z\n"], "X=x\n\nY=y\nZ=z\n\n"), ], ) def test_merge( tmp_path: Path, input_contents: list[str], - append_linesep: bool, expected_output: str, ): output_file = tmp_path / ".env" @@ -38,6 +29,6 @@ def test_merge( merge_file.write_text(input_content) files_to_merge.append(merge_file) - merge(output_file, files_to_merge, append_linesep) + merge(output_file, files_to_merge) assert output_file.read_text() == expected_output