(self)
| 36 | |
| 37 | class ManagerEndToEndTest(tf.test.TestCase): |
| 38 | def setUp(self): |
| 39 | super().setUp() |
| 40 | |
| 41 | # Spy on subprocesses spawned so that we can kill them. |
| 42 | self.popens = [] |
| 43 | |
| 44 | class PopenSpy(subprocess.Popen): |
| 45 | def __init__(p, *args, **kwargs): |
| 46 | super(PopenSpy, p).__init__(*args, **kwargs) |
| 47 | self.popens.append(p) |
| 48 | |
| 49 | popen_patcher = mock.patch.object(subprocess, "Popen", PopenSpy) |
| 50 | popen_patcher.start() |
| 51 | |
| 52 | # Make sure that temporary files (including .tensorboard-info) are |
| 53 | # created under our purview. |
| 54 | self.tmproot = os.path.join(self.get_temp_dir(), "tmproot") |
| 55 | os.mkdir(self.tmproot) |
| 56 | self._patch_environ({"TMPDIR": self.tmproot}) |
| 57 | tempfile.tempdir = None # force `gettempdir` to reinitialize from env |
| 58 | self.assertEqual(tempfile.gettempdir(), self.tmproot) |
| 59 | self.info_dir = manager._get_info_dir() # ensure that directory exists |
| 60 | |
| 61 | # Add our Bazel-provided `tensorboard` to the system path. (The |
| 62 | # //tensorboard:tensorboard target is made available in the same |
| 63 | # directory as //tensorboard:manager_e2e_test.) |
| 64 | tensorboard_binary_dir = os.path.dirname(os.environ["TEST_BINARY"]) |
| 65 | self._patch_environ( |
| 66 | { |
| 67 | "PATH": os.pathsep.join( |
| 68 | (tensorboard_binary_dir, os.environ["PATH"]) |
| 69 | ), |
| 70 | } |
| 71 | ) |
| 72 | self._ensure_tensorboard_on_path(tensorboard_binary_dir) |
| 73 | |
| 74 | def tearDown(self): |
| 75 | failed_kills = [] |
nothing calls this directly
no test coverage detected