From 5dfd27e9540f47756e3ff9d67e9f7e24eb484068 Mon Sep 17 00:00:00 2001 From: Ivan Yordanov Date: Tue, 26 Sep 2023 11:37:11 +0300 Subject: [PATCH] fix: tests in windows --- tests/utils/test_doc_gen.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/utils/test_doc_gen.py b/tests/utils/test_doc_gen.py index 5adfaf046..f5cf64674 100644 --- a/tests/utils/test_doc_gen.py +++ b/tests/utils/test_doc_gen.py @@ -76,13 +76,16 @@ def test_csv_append_env_var( target: Path = tmp_path / "target.csv" csv_append_env_var(target, var_name, default_value, description, *extra_args) with target.open() as t: - assert t.read() == expected_outcome + "\n" + assert ( + t.read().replace("\r\n", "\n").replace("\r", "\n") + == expected_outcome + "\n" + ) def test_write_title_to_dotenv_file(self, tmp_path): target: Path = tmp_path / "target.ENV" write_title_to_dotenv_file(target, "title", "description of length 72" * 3) with target.open() as t: - assert t.read() == ( + assert t.read().replace("\r\n", "\n").replace("\r", "\n") == ( "# title\n" "#\n" "# " @@ -172,7 +175,7 @@ def test_append_csv_to_dotenv_file( f.write(",".join(csv_record)) append_csv_to_dotenv_file(source, target) with target.open("r", newline="") as f: - assert f.read() == expected + assert f.read().replace("\r\n", "\n").replace("\r", "\n") == expected @pytest.mark.parametrize( ("title", "description", "heading", "expected"), @@ -244,7 +247,7 @@ def test_write_csv_to_md_file( f.write(",".join(csv_record)) write_csv_to_md_file(source, target, title, description, heading) with target.open("r", newline="") as f: - assert f.read() == expected + str( + assert f.read().replace("\r\n", "\n").replace("\r", "\n") == expected + str( "|Name|Default Value|Required|Description|Setting name|\n" "|----|-------------|--------|-----------|------------|\n" "|NAME|default |True |description|setting_name|\n",