File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 11import argparse
2+ import difflib
23import filecmp
34import os
45import re
@@ -64,7 +65,25 @@ def run_unasync(output_dir: Path, check: bool = False) -> None:
6465 "" ,
6566 "Differences:" ,
6667 ]
67- raise SystemExit ("\n " .join ([* header , * diffs ]))
68+ details : list [str ] = []
69+ first_diff = next ((d for d in diffs if d .startswith ("Differs: " )), None )
70+ if first_diff :
71+ mismatch = first_diff .replace ("Differs: " , "" )
72+ generated = target_dir / Path (mismatch ).relative_to (SYNC_DIR )
73+ if generated .exists () and Path (mismatch ).exists ():
74+ expected_lines = Path (mismatch ).read_text ().splitlines ()
75+ generated_lines = generated .read_text ().splitlines ()
76+ diff_lines = list (
77+ difflib .unified_diff (
78+ expected_lines ,
79+ generated_lines ,
80+ fromfile = mismatch ,
81+ tofile = str (generated ),
82+ lineterm = "" ,
83+ )
84+ )
85+ details .extend (["" , "Sample diff:" , * diff_lines [:200 ]])
86+ raise SystemExit ("\n " .join ([* header , * diffs , * details ]))
6887
6988
7089def main () -> None :
You can’t perform that action at this time.
0 commit comments