Internal fixes for code coverage testing.
PiperOrigin-RevId: 306261564 Change-Id: I8a2a1e867036f4678812025a504dfa684693c3a4
This commit is contained in:
parent
da4fba5d6d
commit
056c2058c3
tensorflow/examples/saved_model/integration_tests
@ -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)]
|
||||
|
||||
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user