From 1bb320d0beb59b1055d7ea5dda6b66bc1b691133 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Thu, 6 Jun 2019 07:57:55 -0700 Subject: [PATCH] build: use `tf.test.main` for `mesh:demo_utils_test` (#2319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This test case already contains actual TensorFlow code, via the `GFile` use in the code under test. Within Google, such tests must be run via `tf.test.main()` or `absltest.main()`, and the TensorFlow-specific code should be in a `tf.test.TestCase` as well (though this is not strictly required). Test Plan: Verified that this patch fixes a test that’s broken when syncing into Google3. wchargin-branch: tf-test-mesh-test --- tensorboard/plugins/mesh/BUILD | 1 + tensorboard/plugins/mesh/demo_utils_test.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tensorboard/plugins/mesh/BUILD b/tensorboard/plugins/mesh/BUILD index 8472cd2422a..b1c6422aeca 100644 --- a/tensorboard/plugins/mesh/BUILD +++ b/tensorboard/plugins/mesh/BUILD @@ -145,6 +145,7 @@ py_test( srcs = ["demo_utils_test.py"], data = [ ":test_data", + "//tensorboard/compat:tensorflow", ], srcs_version = "PY2AND3", deps = [ diff --git a/tensorboard/plugins/mesh/demo_utils_test.py b/tensorboard/plugins/mesh/demo_utils_test.py index d06befe6295..47ad137dd65 100644 --- a/tensorboard/plugins/mesh/demo_utils_test.py +++ b/tensorboard/plugins/mesh/demo_utils_test.py @@ -20,10 +20,13 @@ import os import unittest + +import tensorflow as tf + from tensorboard.plugins.mesh import demo_utils -class TestPLYReader(unittest.TestCase): +class TestPLYReader(tf.test.TestCase): def test_parse_vertex(self): """Tests vertex coordinate and color parsing.""" # Vertex 3D coordinates with RGBA color. @@ -56,4 +59,4 @@ def test_read_ascii_ply(self): if __name__ == '__main__': - unittest.main() + tf.test.main()