Skip to content

Commit

Permalink
Pre-emptively close file handle to prevent Windows complaining.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jul 12, 2021
1 parent 8cccf1d commit 18a09e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kolibri/utils/tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_do_rollover(self):
def test_getFilesToDelete(self):
temp_dir = tempfile.mkdtemp()
file_handle, log_file = tempfile.mkstemp(suffix=".txt", dir=temp_dir)
os.close(file_handle)
handler = KolibriTimedRotatingFileHandler(log_file, backupCount=3, when="s")
sleep(1)
handler.doRollover()
Expand All @@ -45,6 +46,5 @@ def test_getFilesToDelete(self):
sleep(1)
handler.doRollover()
self.assertEqual(len(handler.getFilesToDelete()), 1)
os.close(file_handle)
os.remove(log_file)
shutil.rmtree(temp_dir, ignore_errors=True)

0 comments on commit 18a09e2

Please sign in to comment.