File tree 1 file changed +16
-1
lines changed 1 file changed +16
-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,21 @@ 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
+ pytest .fail (
29
+ "pyplot.py is not up-to-date. Please run "
30
+ "'python tools/boilerplate.py' to update pyplot.py. "
31
+ "This needs to be done from an environment where your "
32
+ "current working copy is installed (e.g. 'pip install -e'd). "
33
+ "Here is a diff of unexpected differences:\n %s" % diff_msg
34
+ )
20
35
finally :
21
36
Path (plt .__file__ ).write_text (orig_contents )
22
37
You can’t perform that action at this time.
0 commit comments