File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -72,17 +72,22 @@ def test_reorganize(self):
72
72
self .g = gdbm .open (filename , 'c' )
73
73
size0 = os .path .getsize (filename )
74
74
75
- self .g ['x' ] = 'x' * 10000
75
+ # bpo-33901: on macOS with gdbm 1.15, an empty database uses 16 MiB
76
+ # and adding an entry of 10,000 B has no effect on the file size.
77
+ # Add size0 bytes to make sure that the file size changes.
78
+ value_size = max (size0 , 10000 )
79
+ self .g ['x' ] = 'x' * value_size
76
80
size1 = os .path .getsize (filename )
77
- self .assertTrue ( size0 < size1 )
81
+ self .assertGreater ( size1 , size0 )
78
82
79
83
del self .g ['x' ]
80
84
# 'size' is supposed to be the same even after deleting an entry.
81
85
self .assertEqual (os .path .getsize (filename ), size1 )
82
86
83
87
self .g .reorganize ()
84
88
size2 = os .path .getsize (filename )
85
- self .assertTrue (size1 > size2 >= size0 )
89
+ self .assertLess (size2 , size1 )
90
+ self .assertGreaterEqual (size2 , size0 )
86
91
87
92
def test_context_manager (self ):
88
93
with gdbm .open (filename , 'c' ) as db :
Original file line number Diff line number Diff line change
1
+ Fix test_dbm_gnu on macOS with gdbm 1.15: add a larger value to make sure that
2
+ the file size changes.
You can’t perform that action at this time.
0 commit comments