Skip to content

Commit

Permalink
Merge hot fix from 'usnistgov/integration' into rel/1.3.X (LockedFile
Browse files Browse the repository at this point in the history
close bug)
  • Loading branch information
RayPlante committed Apr 15, 2020
2 parents f7179a8 + 06b2ec3 commit 26af041
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/nistoar/pdr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def __enter__(self):
return self.open()

def __exit__(self, e1, e2, e3):
self.close()
return False

def __del__(self):
Expand Down
6 changes: 5 additions & 1 deletion python/tests/nistoar/pdr/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,14 @@ def run(self):
self.f('o')

def lockedop(self, who, mode='r', sleep=0.5):
with utils.LockedFile(self.lfile, mode) as lockdfile:
lf = utils.LockedFile(self.lfile, mode)
self.assertIsNone(lf.fo)
with lf as lockdfile:
self.assertIsNotNone(lf.fo)
self.rfd.write(who+'a')
time.sleep(sleep)
self.rfd.write(who+'r')
self.assertIsNone(lf.fo)

def setUp(self):
self.tf = Tempfiles()
Expand Down

0 comments on commit 26af041

Please sign in to comment.