Skip to content

Commit 4d538ba

Browse files
committed
Make MKDump test work under Windows
see WebwareForPython/w4py@fa79adb
1 parent 1541b7f commit 4d538ba

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import os
1+
import difflib
2+
23

34
def test(store):
45
with open('Dump.csv', 'w') as samples:
56
store.dumpObjectStore(samples)
67

7-
command = 'diff -u ../MKDump.mkmodel/Samples.csv Dump.csv'
8-
print(command)
9-
retval = os.system(command)
10-
if os.name == 'posix':
11-
retval >>= 8 # upper byte is the return code
8+
dumped = open('Dump.csv').readlines()
9+
expected = open('../MKDump.mkmodel/Samples.csv').readlines()
10+
diff = map(str.rstrip, difflib.context_diff(dumped, expected,
11+
fromfile='dumped.csv', tofile='expected.csv'))
12+
13+
for line in diff:
14+
print line
1215

13-
assert retval == 0
16+
assert not diff

0 commit comments

Comments
 (0)