@@ -111,13 +111,29 @@ def checker(payload):
111111 in comment
112112 )
113113
114- expected_output = [
115- "COMMENT_FILE_WRITTEN=true" ,
116- "COVERAGE_PERCENTAGE=0.7777777777777778" ,
117- "REFERENCE_COVERAGE_PERCENTAGE=null" ,
118- ]
119- # The order of keys is not guaranteed, so we'll sort the lines
120- assert sorted (output_file .read_text ().strip ().splitlines ()) == expected_output
114+ expected_output = {
115+ "COMMENT_FILE_WRITTEN" : "true" ,
116+ "NEW_COVERED_LINES" : "7" ,
117+ "NEW_NUM_STATEMENTS" : "9" ,
118+ "NEW_PERCENT_COVERED" : "0.7777777777777778" ,
119+ "NEW_MISSING_LINES" : "2" ,
120+ "NEW_EXCLUDED_LINES" : "0" ,
121+ "NEW_NUM_BRANCHES" : "0" ,
122+ "NEW_NUM_PARTIAL_BRANCHES" : "0" ,
123+ "NEW_COVERED_BRANCHES" : "0" ,
124+ "NEW_MISSING_BRANCHES" : "0" ,
125+ "DIFF_TOTAL_NUM_LINES" : "4" ,
126+ "DIFF_TOTAL_NUM_VIOLATIONS" : "1" ,
127+ "DIFF_TOTAL_PERCENT_COVERED" : "0.75" ,
128+ "DIFF_NUM_CHANGED_LINES" : "6" ,
129+ }
130+ output = {
131+ key : value
132+ for key , value in (
133+ line .split ("=" ) for line in output_file .read_text ().strip ().splitlines ()
134+ )
135+ }
136+ assert output == expected_output
121137
122138
123139@pytest .mark .add_branches ("foo" )
@@ -242,13 +258,38 @@ def checker(payload):
242258 assert comment .count ("<img" ) == 10
243259 assert comment == summary_file .read_text ()
244260
245- expected_output = [
246- "COMMENT_FILE_WRITTEN=false" ,
247- "COVERAGE_PERCENTAGE=0.7777777777777778" ,
248- "REFERENCE_COVERAGE_PERCENTAGE=0.3" ,
249- ]
250- # The order of keys is not guaranteed, so we'll sort the lines
251- assert sorted (output_file .read_text ().strip ().splitlines ()) == expected_output
261+ expected_output = {
262+ "COMMENT_FILE_WRITTEN" : "false" ,
263+ "NEW_COVERED_LINES" : "7" ,
264+ "NEW_NUM_STATEMENTS" : "9" ,
265+ "NEW_PERCENT_COVERED" : "0.7777777777777778" ,
266+ "NEW_MISSING_LINES" : "2" ,
267+ "NEW_EXCLUDED_LINES" : "0" ,
268+ "NEW_NUM_BRANCHES" : "0" ,
269+ "NEW_NUM_PARTIAL_BRANCHES" : "0" ,
270+ "NEW_COVERED_BRANCHES" : "0" ,
271+ "NEW_MISSING_BRANCHES" : "0" ,
272+ "REFERENCE_COVERED_LINES" : "3" ,
273+ "REFERENCE_NUM_STATEMENTS" : "10" ,
274+ "REFERENCE_PERCENT_COVERED" : "0.3" ,
275+ "REFERENCE_MISSING_LINES" : "7" ,
276+ "REFERENCE_EXCLUDED_LINES" : "0" ,
277+ "REFERENCE_NUM_BRANCHES" : "0" ,
278+ "REFERENCE_NUM_PARTIAL_BRANCHES" : "0" ,
279+ "REFERENCE_COVERED_BRANCHES" : "0" ,
280+ "REFERENCE_MISSING_BRANCHES" : "0" ,
281+ "DIFF_TOTAL_NUM_LINES" : "4" ,
282+ "DIFF_TOTAL_NUM_VIOLATIONS" : "1" ,
283+ "DIFF_TOTAL_PERCENT_COVERED" : "0.75" ,
284+ "DIFF_NUM_CHANGED_LINES" : "6" ,
285+ }
286+ output = {
287+ key : value
288+ for key , value in (
289+ line .split ("=" ) for line in output_file .read_text ().strip ().splitlines ()
290+ )
291+ }
292+ assert output == expected_output
252293
253294
254295def test_action__push__non_default_branch (
@@ -319,13 +360,38 @@ def checker(payload):
319360 assert "Coverage for the whole project went from 30% to 77.77%" in comment
320361 assert comment == summary_file .read_text ()
321362
322- expected_output = [
323- "COMMENT_FILE_WRITTEN=false" ,
324- "COVERAGE_PERCENTAGE=0.7777777777777778" ,
325- "REFERENCE_COVERAGE_PERCENTAGE=0.3" ,
326- ]
327- # The order of keys is not guaranteed, so we'll sort the lines
328- assert sorted (output_file .read_text ().strip ().splitlines ()) == expected_output
363+ expected_output = {
364+ "COMMENT_FILE_WRITTEN" : "false" ,
365+ "NEW_COVERED_LINES" : "7" ,
366+ "NEW_NUM_STATEMENTS" : "9" ,
367+ "NEW_PERCENT_COVERED" : "0.7777777777777778" ,
368+ "NEW_MISSING_LINES" : "2" ,
369+ "NEW_EXCLUDED_LINES" : "0" ,
370+ "NEW_NUM_BRANCHES" : "0" ,
371+ "NEW_NUM_PARTIAL_BRANCHES" : "0" ,
372+ "NEW_COVERED_BRANCHES" : "0" ,
373+ "NEW_MISSING_BRANCHES" : "0" ,
374+ "REFERENCE_COVERED_LINES" : "3" ,
375+ "REFERENCE_NUM_STATEMENTS" : "10" ,
376+ "REFERENCE_PERCENT_COVERED" : "0.3" ,
377+ "REFERENCE_MISSING_LINES" : "7" ,
378+ "REFERENCE_EXCLUDED_LINES" : "0" ,
379+ "REFERENCE_NUM_BRANCHES" : "0" ,
380+ "REFERENCE_NUM_PARTIAL_BRANCHES" : "0" ,
381+ "REFERENCE_COVERED_BRANCHES" : "0" ,
382+ "REFERENCE_MISSING_BRANCHES" : "0" ,
383+ "DIFF_TOTAL_NUM_LINES" : "4" ,
384+ "DIFF_TOTAL_NUM_VIOLATIONS" : "1" ,
385+ "DIFF_TOTAL_PERCENT_COVERED" : "0.75" ,
386+ "DIFF_NUM_CHANGED_LINES" : "6" ,
387+ }
388+ output = {
389+ key : value
390+ for key , value in (
391+ line .split ("=" ) for line in output_file .read_text ().strip ().splitlines ()
392+ )
393+ }
394+ assert output == expected_output
329395
330396
331397def test_action__push__no_branch (
@@ -400,13 +466,38 @@ def test_action__push__non_default_branch__no_pr(
400466
401467 assert pathlib .Path ("python-coverage-comment-action.txt" ).exists ()
402468
403- expected_output = [
404- "COMMENT_FILE_WRITTEN=true" ,
405- "COVERAGE_PERCENTAGE=0.7777777777777778" ,
406- "REFERENCE_COVERAGE_PERCENTAGE=0.3" ,
407- ]
408- # The order of keys is not guaranteed, so we'll sort the lines
409- assert sorted (output_file .read_text ().strip ().splitlines ()) == expected_output
469+ expected_output = {
470+ "COMMENT_FILE_WRITTEN" : "true" ,
471+ "NEW_COVERED_LINES" : "7" ,
472+ "NEW_NUM_STATEMENTS" : "9" ,
473+ "NEW_PERCENT_COVERED" : "0.7777777777777778" ,
474+ "NEW_MISSING_LINES" : "2" ,
475+ "NEW_EXCLUDED_LINES" : "0" ,
476+ "NEW_NUM_BRANCHES" : "0" ,
477+ "NEW_NUM_PARTIAL_BRANCHES" : "0" ,
478+ "NEW_COVERED_BRANCHES" : "0" ,
479+ "NEW_MISSING_BRANCHES" : "0" ,
480+ "REFERENCE_COVERED_LINES" : "3" ,
481+ "REFERENCE_NUM_STATEMENTS" : "10" ,
482+ "REFERENCE_PERCENT_COVERED" : "0.3" ,
483+ "REFERENCE_MISSING_LINES" : "7" ,
484+ "REFERENCE_EXCLUDED_LINES" : "0" ,
485+ "REFERENCE_NUM_BRANCHES" : "0" ,
486+ "REFERENCE_NUM_PARTIAL_BRANCHES" : "0" ,
487+ "REFERENCE_COVERED_BRANCHES" : "0" ,
488+ "REFERENCE_MISSING_BRANCHES" : "0" ,
489+ "DIFF_TOTAL_NUM_LINES" : "4" ,
490+ "DIFF_TOTAL_NUM_VIOLATIONS" : "1" ,
491+ "DIFF_TOTAL_PERCENT_COVERED" : "0.75" ,
492+ "DIFF_NUM_CHANGED_LINES" : "6" ,
493+ }
494+ output = {
495+ key : value
496+ for key , value in (
497+ line .split ("=" ) for line in output_file .read_text ().strip ().splitlines ()
498+ )
499+ }
500+ assert output == expected_output
410501
411502
412503def test_action__pull_request__force_store_comment (
@@ -436,13 +527,38 @@ def test_action__pull_request__force_store_comment(
436527
437528 assert pathlib .Path ("python-coverage-comment-action.txt" ).exists ()
438529
439- expected_output = [
440- "COMMENT_FILE_WRITTEN=true" ,
441- "COVERAGE_PERCENTAGE=0.7777777777777778" ,
442- "REFERENCE_COVERAGE_PERCENTAGE=0.3" ,
443- ]
444- # The order of keys is not guaranteed, so we'll sort the lines
445- assert sorted (output_file .read_text ().strip ().splitlines ()) == expected_output
530+ expected_output = {
531+ "COMMENT_FILE_WRITTEN" : "true" ,
532+ "NEW_COVERED_LINES" : "7" ,
533+ "NEW_NUM_STATEMENTS" : "9" ,
534+ "NEW_PERCENT_COVERED" : "0.7777777777777778" ,
535+ "NEW_MISSING_LINES" : "2" ,
536+ "NEW_EXCLUDED_LINES" : "0" ,
537+ "NEW_NUM_BRANCHES" : "0" ,
538+ "NEW_NUM_PARTIAL_BRANCHES" : "0" ,
539+ "NEW_COVERED_BRANCHES" : "0" ,
540+ "NEW_MISSING_BRANCHES" : "0" ,
541+ "REFERENCE_COVERED_LINES" : "3" ,
542+ "REFERENCE_NUM_STATEMENTS" : "10" ,
543+ "REFERENCE_PERCENT_COVERED" : "0.3" ,
544+ "REFERENCE_MISSING_LINES" : "7" ,
545+ "REFERENCE_EXCLUDED_LINES" : "0" ,
546+ "REFERENCE_NUM_BRANCHES" : "0" ,
547+ "REFERENCE_NUM_PARTIAL_BRANCHES" : "0" ,
548+ "REFERENCE_COVERED_BRANCHES" : "0" ,
549+ "REFERENCE_MISSING_BRANCHES" : "0" ,
550+ "DIFF_TOTAL_NUM_LINES" : "4" ,
551+ "DIFF_TOTAL_NUM_VIOLATIONS" : "1" ,
552+ "DIFF_TOTAL_PERCENT_COVERED" : "0.75" ,
553+ "DIFF_NUM_CHANGED_LINES" : "6" ,
554+ }
555+ output = {
556+ key : value
557+ for key , value in (
558+ line .split ("=" ) for line in output_file .read_text ().strip ().splitlines ()
559+ )
560+ }
561+ assert output == expected_output
446562
447563
448564def test_action__pull_request__post_comment__no_marker (
0 commit comments