File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change
1
+ import difflib
1
2
import subprocess
2
3
import sys
3
4
from pathlib import Path
@@ -16,7 +17,19 @@ def test_pyplot_up_to_date():
16
17
try :
17
18
subprocess .run ([sys .executable , str (gen_script )], check = True )
18
19
new_contents = Path (plt .__file__ ).read_text ()
19
- assert orig_contents == new_contents
20
+
21
+ if orig_contents != new_contents :
22
+ diff_msg = '\n ' .join (
23
+ difflib .unified_diff (
24
+ orig_contents .split ('\n ' ), new_contents .split ('\n ' ),
25
+ fromfile = 'found pyplot.py' ,
26
+ tofile = 'expected pyplot.py' ,
27
+ n = 0 , lineterm = '' ))
28
+ raise AssertionError (
29
+ "pyplot.py is not up-to-date. Please rerun "
30
+ "'python pytools/boilerplate.py' to update pyplot.py. "
31
+ "Here is a diff of unexpected differences:\n %s" % diff_msg
32
+ )
20
33
finally :
21
34
Path (plt .__file__ ).write_text (orig_contents )
22
35
You can’t perform that action at this time.
0 commit comments