Skip to content

Commit

Permalink
Fixed open file blocking delete during test.
Browse files Browse the repository at this point in the history
  • Loading branch information
arkottke committed Sep 29, 2015
1 parent 4794e1a commit 291cdec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyrvt/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import os
import tempfile
import shutil
import time

from numpy.testing import assert_almost_equal, assert_allclose, \
assert_equal
Expand Down Expand Up @@ -120,6 +121,7 @@ def check_write_events(ext):
# Reload the data
_ext, _periods, _events = tools.read_events(dst_fname, 'psa_target')

# Delete the temporary file
os.unlink(dst_fname)

assert_equal(ext, _ext)
Expand Down
4 changes: 4 additions & 0 deletions pyrvt/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def parse(s):
wb = openpyxl.load_workbook(fname, read_only=True)
ws = wb.worksheets[0]
rows = [[r.value for r in row] for row in ws.rows]
# Close the file so that it may be deleted if needed. This is only
# important so that in the test cases the temporary .xlsx file can be
# deleted.
wb._archive.close()
else:
raise NotImplementedError

Expand Down

0 comments on commit 291cdec

Please sign in to comment.