Skip to content

Commit f469a91

Browse files
committed
TST: skip failure to remove file in HDFStore tests. close #2645
1 parent c03eb07 commit f469a91

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pandas/io/pytables.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ def _tables():
109109

110110
return _table_mod
111111

112-
112+
def h5_open(path, mode):
113+
tables = _tables()
114+
return tables.openFile(path, mode)
115+
116+
113117
@contextmanager
114118
def get_store(path, mode='a', complevel=None, complib=None,
115119
fletcher32=False):
@@ -288,11 +292,11 @@ def open(self, mode='a', warn=True):
288292
fletcher32=self.fletcher32)
289293

290294
try:
291-
self.handle = _tables().openFile(self.path, self.mode)
295+
self.handle = h5_open(self.path, self.mode)
292296
except IOError, e: # pragma: no cover
293297
if 'can not be written' in str(e):
294298
print 'Opening %s in read-only mode' % self.path
295-
self.handle = _tables().openFile(self.path, 'r')
299+
self.handle = h5_open(self.path, 'r')
296300
else:
297301
raise
298302

pandas/io/tests/test_pytables.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ def setUp(self):
3737

3838
def tearDown(self):
3939
self.store.close()
40-
os.remove(self.path)
40+
try:
41+
os.remove(self.path)
42+
except os.error:
43+
pass
4144

4245
def test_factory_fun(self):
4346
try:

0 commit comments

Comments
 (0)