|
23 | 23 | import numpy as np
|
24 | 24 | import tensorflow as tf
|
25 | 25 | import time
|
| 26 | +from unittest import mock |
26 | 27 |
|
27 | 28 | from werkzeug import test as werkzeug_test
|
28 | 29 | from werkzeug import wrappers
|
|
36 | 37 | from tensorboard.plugins.mesh import plugin_data_pb2
|
37 | 38 | from tensorboard.plugins.mesh import test_utils
|
38 | 39 | from tensorboard.util import test_util as tensorboard_test_util
|
39 |
| -from mock import patch |
40 |
| - |
41 |
| -try: |
42 |
| - # python version >= 3.3 |
43 |
| - from unittest import mock |
44 |
| -except ImportError: |
45 |
| - import mock # pylint: disable=unused-import |
46 | 40 |
|
47 | 41 |
|
48 | 42 | class MeshPluginTest(tf.test.TestCase):
|
@@ -129,7 +123,7 @@ def setUp(self):
|
129 | 123 | if step % 2 == 0
|
130 | 124 | else mesh_no_color_extended
|
131 | 125 | )
|
132 |
| - with patch.object(time, "time", return_value=step): |
| 126 | + with mock.patch.object(time, "time", return_value=step): |
133 | 127 | writer.add_summary(
|
134 | 128 | sess.run(
|
135 | 129 | merged_summary_op,
|
@@ -264,14 +258,6 @@ def testsEventsAlwaysSortedByStep(self):
|
264 | 258 | self.assertLessEqual(metadata[i - 1]["step"], metadata[i]["step"])
|
265 | 259 |
|
266 | 260 | def testIsActive(self):
|
267 |
| - self.assertTrue(self.plugin.is_active()) |
268 |
| - |
269 |
| - @mock.patch.object( |
270 |
| - event_multiplexer.EventMultiplexer, |
271 |
| - "PluginRunToTagToContent", |
272 |
| - return_value={}, |
273 |
| - ) |
274 |
| - def testIsInactive(self, get_random_mesh_stub): |
275 | 261 | self.assertFalse(self.plugin.is_active())
|
276 | 262 |
|
277 | 263 |
|
|
0 commit comments