From 4004180b75c922f6c8573ff92a0baeea5cc63ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Mon, 4 Jul 2022 17:21:28 +0200 Subject: [PATCH] tests: make tests forward compatible for tomlkit fix for consistent line endings --- tests/console/commands/test_add.py | 10 ++++++++-- tests/console/commands/test_remove.py | 26 ++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/tests/console/commands/test_add.py b/tests/console/commands/test_add.py index 6c093b2d550..3d83e0a3d36 100644 --- a/tests/console/commands/test_add.py +++ b/tests/console/commands/test_add.py @@ -870,8 +870,14 @@ def test_add_to_section_that_does_not_exist_yet( cachy = "^0.2.0" """ - - assert expected in content.as_string() + # At the moment line endings will be inconsistent on Windows. + # See https://github.com/sdispater/tomlkit/issues/200 for details. + # https://github.com/sdispater/tomlkit/pull/201 fixes this issue + # In order to make tests forward compatible for tomlkit downstream tests, + # we replace "\r\n" with "\n" for now. + string_content = content.as_string().replace("\r\n", "\n") + + assert expected in string_content def test_add_to_dev_section_deprecated( diff --git a/tests/console/commands/test_remove.py b/tests/console/commands/test_remove.py index 4911fac7aba..b65f2c9a955 100644 --- a/tests/console/commands/test_remove.py +++ b/tests/console/commands/test_remove.py @@ -93,8 +93,14 @@ def test_remove_without_specific_group_removes_from_all_groups( baz = "^1.0.0" """ + # At the moment line endings will be inconsistent on Windows. + # See https://github.com/sdispater/tomlkit/issues/200 for details. + # https://github.com/sdispater/tomlkit/pull/201 fixes this issue + # In order to make tests forward compatible for tomlkit downstream tests, + # we replace "\r\n" with "\n" for now. + string_content = content.as_string().replace("\r\n", "\n") - assert expected in content.as_string() + assert expected in string_content def test_remove_without_specific_group_removes_from_specific_groups( @@ -148,8 +154,14 @@ def test_remove_without_specific_group_removes_from_specific_groups( baz = "^1.0.0" """ + # At the moment line endings will be inconsistent on Windows. + # See https://github.com/sdispater/tomlkit/issues/200 for details. + # https://github.com/sdispater/tomlkit/pull/201 fixes this issue + # In order to make tests forward compatible for tomlkit downstream tests, + # we replace "\r\n" with "\n" for now. + string_content = content.as_string().replace("\r\n", "\n") - assert expected in content.as_string() + assert expected in string_content def test_remove_does_not_live_empty_groups( @@ -251,8 +263,14 @@ def test_remove_canonicalized_named_removes_dependency_correctly( baz = "^1.0.0" """ - - assert expected in content.as_string() + # At the moment line endings will be inconsistent on Windows. + # See https://github.com/sdispater/tomlkit/issues/200 for details. + # https://github.com/sdispater/tomlkit/pull/201 fixes this issue + # In order to make tests forward compatible for tomlkit downstream tests, + # we replace "\r\n" with "\n" for now. + string_content = content.as_string().replace("\r\n", "\n") + + assert expected in string_content def test_remove_command_should_not_write_changes_upon_installer_errors(