diff_unittest.py 661 字节
Newer Older
1 2 3 4
#!/usr/bin/env python
import difflib
import sys

5 6 7
try:
    f1 = open(sys.argv[1], 'r')
    origin = f1.read()
8
    origin = origin.splitlines()
9 10 11 12
except:
    sys.exit(0)
else:
    f1.close()
13

14 15 16
try:
    f2 = open(sys.argv[2], 'r')
    new = f2.read()
17
    new = new.splitlines()
18 19 20 21
except:
    sys.exit(0)
else:
    f2.close()
22 23 24

error = False
diffs = []
25 26
for i in origin:
    if i not in new:
27
        error = True
28
        diffs.append(i)
29 30 31 32
'''
If you delete the unit test, such as commenting it out, 
please ask for approval of one RD below for passing CI:

33
    - kolinwei(recommended) or zhouwei25
34 35 36
'''
if error:
    for each_diff in diffs:
37
        print("- %s" % each_diff)