Skip to content

Commit e198c9e

Browse files
committed
Fix different diff in test_cfn_project_main_diff_assets for Python3.14
From python/cpython#119492, "This may change results in some cases, but no natural ones come to mind, and I don't care about contrived cases." and also "Correctness of diffs is not affected. Some similar lines far apart may be reported as deleting one and adding the other, where before they were displayed on adjacent output lines with markup showing the intraline differences.". This change breaks the test for Python3.14
1 parent 2a3f7ce commit e198c9e

File tree

2 files changed

+13
-42
lines changed

2 files changed

+13
-42
lines changed

tests/tests_e3_aws/troposphere/cfn_project_test.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import TYPE_CHECKING
77
from unittest.mock import patch
88
from tempfile import TemporaryDirectory
9+
from textwrap import dedent
910

1011
from e3.aws import AWSEnv
1112
from e3.aws.troposphere import CFNProjectMain
@@ -227,10 +228,20 @@ def mocked_color_diff(lines: list[str]) -> list[str]:
227228
# Diff with the mocked response
228229
test.execute(args=["show", "--diff", "--assets"], aws_env=aws_env)
229230

231+
# Only check that the diff part for the code asset of the lambda is in the output.
232+
# Checking the whole diff gives different results depending if we are running
233+
# Python < 3.14 or Python >= 3.14 https://github.com/python/cpython/pull/119492
230234
captured = capfd.readouterr()
231235
print(captured.out)
232-
with open(os.path.join(TEST_DIR, "cfn_project_test_diff_assets.out")) as f_out:
233-
assert captured.out == f_out.read()
236+
assert (
237+
dedent(
238+
"""\
239+
Diff for the new version of function mypylambda:
240+
+ app.py
241+
"""
242+
)
243+
in captured.out
244+
)
234245

235246

236247
def test_cfn_project_main_show_assets(capfd: pytest.CaptureFixture[str]) -> None:

tests/tests_e3_aws/troposphere/cfn_project_test_diff_assets.out

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)