File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import argparse
6
6
import os
7
- import subprocess
8
7
import sys
9
8
10
- from test_util import TestFailedError , run_command , \
11
- serializeIncrParseMarkupFile
9
+ from test_util import TestFailedError , serializeIncrParseMarkupFile
12
10
13
11
14
12
def main ():
@@ -102,19 +100,18 @@ def main():
102
100
sys .exit (1 )
103
101
104
102
# Check if the two syntax trees are the same
105
- try :
106
- run_command (
107
- [
108
- 'diff' , '-u' ,
109
- incremental_serialized_file ,
110
- post_edit_serialized_file
111
- ])
112
- except subprocess .CalledProcessError as e :
103
+ import difflib
104
+ lines = difflib .unified_diff (open (incremental_serialized_file ).readlines (),
105
+ open (post_edit_serialized_file ).readlines (),
106
+ fromfile = incremental_serialized_file ,
107
+ tofile = incremental_serialized_file )
108
+ diff = '\n ' .join (line for line in lines )
109
+ if diff :
113
110
print ('Test case "%s" of %s FAILed' % (test_case , test_file ),
114
111
file = sys .stderr )
115
112
print ('Syntax tree of incremental parsing does not match '
116
113
'from-scratch parsing of post-edit file:\n \n ' , file = sys .stderr )
117
- print (e . output , file = sys .stderr )
114
+ print (diff , file = sys .stderr )
118
115
sys .exit (1 )
119
116
120
117
You can’t perform that action at this time.
0 commit comments