Skip to content

Commit

Permalink
review: add test for filename-taken case
Browse files Browse the repository at this point in the history
Test Plan:
Fingers crossed (haven’t run locally; will see what Travis thinks).

wchargin-branch: tensorboardinfo-io
  • Loading branch information
wchargin committed Feb 6, 2019
1 parent d224fad commit 41b4625
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tensorboard/manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import print_function

import datetime
import errno
import json
import os
import re
Expand Down Expand Up @@ -258,6 +259,14 @@ def setUp(self):
def _list_info_dir(self):
return os.listdir(self.info_dir)

def test_fails_if_info_dir_name_is_taken_by_a_regular_file(self):
os.rmdir(self.info_dir)
with open(self.info_dir, "w") as outfile:
pass
with self.assertRaises(OSError) as cm:
manager._get_info_dir()
self.assertEqual(cm.exception.errno, errno.EEXIST, cm.exception)

@mock.patch("os.getpid", lambda: 76540)
def test_write_remove_info_file(self):
info = _make_info()
Expand Down

0 comments on commit 41b4625

Please sign in to comment.