Skip to content

Commit 37f7b89

Browse files
Fix dumpObjectStore to dump objects in a consistent order for better
testability. Update MKDump test to check diff return code correctly under windows.
1 parent fffba56 commit 37f7b89

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

webware/MiddleKit/Run/SQLObjectStore.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ def dumpKlassIds(self, out=None):
716716
def dumpObjectStore(self, out=None, progress=False):
717717
if out is None:
718718
out = sys.stdout
719-
for klass in list(self.model().klasses().values()):
719+
klasses = sorted(list(self.model().klasses().values()), key=lambda k: k.name())
720+
for klass in klasses:
720721
if progress:
721722
sys.stderr.write(".")
722723
out.write('%s objects\n' % (klass.name()))

webware/MiddleKit/Tests/MKDump.mkmodel/Samples.csv

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ Bar objects
22
barNonstandardId,name
33
3,string containing spaces
44

5+
Baz objects
6+
bazNonstandardId,name,priority
7+
4,"string containing 'lots'' of ""quotes""
8+
and a newline and a tab",10
9+
510
Foo objects
611
fooNonstandardId,text,bar,fruit,num,isValid
712
5,hello,Bar.3,apple,5,1
813
6,,Baz.4,banana,,0
914
7,,,banana,,0
1015

11-
Baz objects
12-
bazNonstandardId,name,priority
13-
4,"string containing 'lots'' of ""quotes""
14-
and a newline and a tab",10
15-
1616

webware/MiddleKit/Tests/MKDump.mkmodel/TestSamples.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def test(store):
77
command = 'diff -u ../MKDump.mkmodel/Samples.csv Dump.csv'
88
print(command)
99
retval = os.system(command)
10-
retval >>= 8 # upper byte is the return code
10+
if os.name == 'posix':
11+
retval >>= 8 # upper byte is the return code
1112

1213
assert retval == 0

0 commit comments

Comments
 (0)