Skip to content

Commit eb2d7ae

Browse files
adapt test
1 parent bc3239f commit eb2d7ae

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

tests/integration/test_main.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ def checker(payload):
111111
in comment
112112
)
113113

114-
expected_output = "COMMENT_FILE_WRITTEN=true\n"
115-
116-
assert output_file.read_text() == expected_output
114+
expected_output = "COMMENT_FILE_WRITTEN=true\nCOVERAGE_PERCENTAGE=0.7777777777777778\nREFERENCE_COVERAGE_PERCENTAGE=null\n"
115+
# The order of keys is not guaranteed, so we'll sort the lines
116+
assert sorted(output_file.read_text().splitlines()) == sorted(
117+
expected_output.splitlines()
118+
)
117119

118120

119121
@pytest.mark.add_branches("foo")
@@ -238,9 +240,11 @@ def checker(payload):
238240
assert comment.count("<img") == 10
239241
assert comment == summary_file.read_text()
240242

241-
expected_output = "COMMENT_FILE_WRITTEN=false\n"
242-
243-
assert output_file.read_text() == expected_output
243+
expected_output = "COMMENT_FILE_WRITTEN=false\nCOVERAGE_PERCENTAGE=0.7777777777777778\nREFERENCE_COVERAGE_PERCENTAGE=0.3\n"
244+
# The order of keys is not guaranteed, so we'll sort the lines
245+
assert sorted(output_file.read_text().splitlines()) == sorted(
246+
expected_output.splitlines()
247+
)
244248

245249

246250
def test_action__push__non_default_branch(
@@ -311,9 +315,11 @@ def checker(payload):
311315
assert "Coverage for the whole project went from 30% to 77.77%" in comment
312316
assert comment == summary_file.read_text()
313317

314-
expected_output = "COMMENT_FILE_WRITTEN=false\n"
315-
316-
assert output_file.read_text() == expected_output
318+
expected_output = "COMMENT_FILE_WRITTEN=false\nCOVERAGE_PERCENTAGE=0.7777777777777778\nREFERENCE_COVERAGE_PERCENTAGE=0.3\n"
319+
# The order of keys is not guaranteed, so we'll sort the lines
320+
assert sorted(output_file.read_text().splitlines()) == sorted(
321+
expected_output.splitlines()
322+
)
317323

318324

319325
def test_action__push__no_branch(
@@ -388,9 +394,11 @@ def test_action__push__non_default_branch__no_pr(
388394

389395
assert pathlib.Path("python-coverage-comment-action.txt").exists()
390396

391-
expected_output = "COMMENT_FILE_WRITTEN=true\n"
392-
393-
assert output_file.read_text() == expected_output
397+
expected_output = "COMMENT_FILE_WRITTEN=true\nCOVERAGE_PERCENTAGE=0.7777777777777778\nREFERENCE_COVERAGE_PERCENTAGE=0.3\n"
398+
# The order of keys is not guaranteed, so we'll sort the lines
399+
assert sorted(output_file.read_text().splitlines()) == sorted(
400+
expected_output.splitlines()
401+
)
394402

395403

396404
def test_action__pull_request__force_store_comment(
@@ -420,9 +428,11 @@ def test_action__pull_request__force_store_comment(
420428

421429
assert pathlib.Path("python-coverage-comment-action.txt").exists()
422430

423-
expected_output = "COMMENT_FILE_WRITTEN=true\n"
424-
425-
assert output_file.read_text() == expected_output
431+
expected_output = "COMMENT_FILE_WRITTEN=true\nCOVERAGE_PERCENTAGE=0.7777777777777778\nREFERENCE_COVERAGE_PERCENTAGE=0.3\n"
432+
# The order of keys is not guaranteed, so we'll sort the lines
433+
assert sorted(output_file.read_text().splitlines()) == sorted(
434+
expected_output.splitlines()
435+
)
426436

427437

428438
def test_action__pull_request__post_comment__no_marker(

0 commit comments

Comments
 (0)