From 056c2058c3f0ace94064aa8a7714797d9fb2727c Mon Sep 17 00:00:00 2001 From: Amit Patankar Date: Mon, 13 Apr 2020 10:41:55 -0700 Subject: [PATCH] Internal fixes for code coverage testing. PiperOrigin-RevId: 306261564 Change-Id: I8a2a1e867036f4678812025a504dfa684693c3a4 --- .../integration_tests/distribution_strategy_utils.py | 8 +------- .../integration_tests/integration_scripts.py | 12 +----------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/tensorflow/examples/saved_model/integration_tests/distribution_strategy_utils.py b/tensorflow/examples/saved_model/integration_tests/distribution_strategy_utils.py index 79267d80311..eabe4cf3802 100644 --- a/tensorflow/examples/saved_model/integration_tests/distribution_strategy_utils.py +++ b/tensorflow/examples/saved_model/integration_tests/distribution_strategy_utils.py @@ -19,7 +19,6 @@ from __future__ import division from __future__ import print_function import collections -import os import sys from tensorflow.python.distribute import strategy_combinations @@ -36,12 +35,7 @@ _strategies = [ # The presence of GPU strategies upsets TPU initialization, # despite their test instances being skipped early. This is a workaround # for b/145386854. -# -# See comments in TestCase.assertCommandSucceeded for background on these -# sys.executable and TEST_BINARY checks. -if ("test_tpu" in sys.argv[0] or - (sys.executable is None and os.environ["TEST_BINARY"] is not None and - "test_tpu" in os.environ["TEST_BINARY"])): +if "test_tpu" in sys.argv[0]: _strategies = [s for s in _strategies if "GPU" not in str(s)] diff --git a/tensorflow/examples/saved_model/integration_tests/integration_scripts.py b/tensorflow/examples/saved_model/integration_tests/integration_scripts.py index 28a6cb6cd0f..b4e37fba5bc 100644 --- a/tensorflow/examples/saved_model/integration_tests/integration_scripts.py +++ b/tensorflow/examples/saved_model/integration_tests/integration_scripts.py @@ -46,17 +46,7 @@ class TestCase(tf.test.TestCase): def assertCommandSucceeded(self, script_name, **flags): """Runs an integration test script with given flags.""" run_script = sys.argv[0] - - # sys.executable may be None in hermetic Python builds - # (go/hermeticpython#sysexecutable). - # - # TEST_BINARY is an undocumented part of the test environment, but it - # appears to be the only way to recover the path to the test binary under - # coverage runs - the coverage launcher script rewrites argv[0] - # (b/23027507). - if sys.executable is None and os.environ["TEST_BINARY"] is not None: - command_parts = [os.environ["TEST_BINARY"]] - elif run_script.endswith(".py"): + if run_script.endswith(".py"): command_parts = [sys.executable, run_script] else: command_parts = [run_script]