Skip to content

Commit 1dbe01d

Browse files
committed
TST: use ensure_clean contextmanager to avoid spewing temporary files if
testing is interrupted
1 parent 27e8dea commit 1dbe01d

File tree

2 files changed

+1395
-1303
lines changed

2 files changed

+1395
-1303
lines changed

pandas/io/pytables.py

+17
Original file line numberDiff line numberDiff line change
@@ -2552,6 +2552,11 @@ def write_data(self, chunksize):
25522552

25532553
def write_data_chunk(self, indexes, mask, search, values):
25542554

2555+
# 0 len
2556+
for v in values:
2557+
if not np.prod(v.shape):
2558+
return
2559+
25552560
# get our function
25562561
try:
25572562
func = getattr(lib, "create_hdf_rows_%sd" % self.ndim)
@@ -3139,3 +3144,15 @@ def select_coords(self):
31393144
return self.table.table.getWhereList(self.condition, start=self.start, stop=self.stop, sort=True)
31403145

31413146

3147+
### utilities ###
3148+
3149+
def timeit(key,df,fn=None,remove=True,**kwargs):
3150+
if fn is None:
3151+
fn = 'timeit.h5'
3152+
store = HDFStore(fn,mode='w')
3153+
store.append(key,df,**kwargs)
3154+
store.close()
3155+
3156+
if remove:
3157+
import os
3158+
os.remove(fn)

0 commit comments

Comments
 (0)