File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
test/migration-tool-tests/src/test/resources Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import filecmp
5
5
import os
6
6
import shutil , errno
7
7
import argparse
8
+ import difflib
8
9
9
10
RESOURCE_DIR = os .path .join (os .path .dirname (os .path .dirname (os .path .abspath (__file__ ))), "resources" )
10
11
BEFORE_DIR = os .path .join (RESOURCE_DIR , "before" )
@@ -29,11 +30,19 @@ def run_test(version):
29
30
comparison = filecmp .dircmp (TARGET_DIR , AFTER_DIR )
30
31
is_same = compare_directory (filecmp .dircmp (TARGET_DIR , AFTER_DIR ))
31
32
if not is_same :
32
- comparison .report_full_closure ()
33
33
raise Exception ("The transformed directory('target/generated-test-sources/project') does not match with the expected one('src/test/resources/after')" )
34
34
35
35
def compare_directory (dcmp ):
36
36
if dcmp .diff_files or dcmp .left_only or dcmp .right_only :
37
+ for diff_file in dcmp .diff_files :
38
+ file1 = open (dcmp .right + "/" + diff_file , 'r' )
39
+ file2 = open (dcmp .left + "/" + diff_file , 'r' )
40
+ diff = difflib .ndiff (file1 .readlines (), file2 .readlines ())
41
+ changes = [l for l in diff if l .startswith ('+ ' ) or l .startswith ('- ' )]
42
+ print ("Diff found in file: " + diff_file )
43
+ for change in changes :
44
+ print (change )
45
+
37
46
return False
38
47
for sub_dcmp in dcmp .subdirs .values ():
39
48
if not compare_directory (sub_dcmp ):
You can’t perform that action at this time.
0 commit comments