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
@@ -65,7 +66,25 @@ def run_unasync(output_dir: Path, check: bool = False) -> None:
6566 "" ,
6667 "Differences:" ,
6768 ]
68- raise SystemExit ("\n " .join ([* header , * diffs ]))
69+ details : list [str ] = []
70+ first_diff = next ((d for d in diffs if d .startswith ("Differs: " )), None )
71+ if first_diff :
72+ mismatch = first_diff .replace ("Differs: " , "" )
73+ generated = target_dir / Path (mismatch ).relative_to (SYNC_DIR )
74+ if generated .exists () and Path (mismatch ).exists ():
75+ expected_lines = Path (mismatch ).read_text ().splitlines ()
76+ generated_lines = generated .read_text ().splitlines ()
77+ diff_lines = list (
78+ difflib .unified_diff (
79+ expected_lines ,
80+ generated_lines ,
81+ fromfile = mismatch ,
82+ tofile = str (generated ),
83+ lineterm = "" ,
84+ )
85+ )
86+ details .extend (["" , "Sample diff:" , * diff_lines [:200 ]])
87+ raise SystemExit ("\n " .join ([* header , * diffs , * details ]))
6988
7089
7190def main () -> None :
You can’t perform that action at this time.
0 commit comments