Merge "Added an option to fail the empty invocation."
diff --git a/atest/atest_utils.py b/atest/atest_utils.py
index 9a7178e..f1be007 100644
--- a/atest/atest_utils.py
+++ b/atest/atest_utils.py
@@ -16,6 +16,7 @@
Utility functions for atest.
"""
+
from __future__ import print_function
import hashlib
@@ -36,13 +37,6 @@
from metrics import metrics_base
from metrics import metrics_utils
-try:
- # If PYTHON2
- from urllib2 import urlopen
-except ImportError:
- metrics_utils.handle_exc_and_send_exit_event(
- constants.IMPORT_FAILURE)
- from urllib.request import urlopen
_BASH_RESET_CODE = '\033[0m\n'
# Arbitrary number to limit stdout for failed runs in _run_limited_output.
@@ -204,6 +198,13 @@
# TODO: Also check if we have a slow connection to result server.
if constants.RESULT_SERVER:
try:
+ try:
+ # If PYTHON2
+ from urllib2 import urlopen
+ except ImportError:
+ metrics_utils.handle_exc_and_send_exit_event(
+ constants.IMPORT_FAILURE)
+ from urllib.request import urlopen
urlopen(constants.RESULT_SERVER,
timeout=constants.RESULT_SERVER_TIMEOUT).close()
return True
diff --git a/atest/docs/developer_workflow.md b/atest/docs/developer_workflow.md
index 4f5d916..d3c2a32 100644
--- a/atest/docs/developer_workflow.md
+++ b/atest/docs/developer_workflow.md
@@ -6,7 +6,7 @@
1. [Identify the code you should work on](#identify-the-code-you-should-work-on)
2. [Working on the Python Code](#working-on-the-python-code)
3. [Working on the TradeFed Code](#working-on-the-tradefed-code)
-4. [Working on the VTS-TradeFed Code](#working-on-the-vts-tradefed-code)
+4. [Working on the VTS10-TradeFed Code](#working-on-the-vts10-tradefed-code)
5. [Working on the Robolectric Code](#working-on-the-robolectric-code)
@@ -44,7 +44,7 @@
Each test runner will have a different workflow. Atest currently
supports the following test runners:
- TradeFed
-- VTS-TradeFed
+- VTS10-TradeFed
- Robolectric
@@ -121,7 +121,7 @@
Before submitting code you should run all the TradeFed tests.
-## <a name="working-on-the-vts-tradefed-code">Working on the VTS-TradeFed Code</a>
+## <a name="working-on-the-vts10-tradefed-code">Working on the VTS10-TradeFed Code</a>
##### Where does the VTS10-TradeFed code live?
diff --git a/atest/test_runners/atest_tf_test_runner.py b/atest/test_runners/atest_tf_test_runner.py
index 5380423..6f26c6d 100644
--- a/atest/test_runners/atest_tf_test_runner.py
+++ b/atest/test_runners/atest_tf_test_runner.py
@@ -107,7 +107,7 @@
key_path = os.path.join(self.root_dir, ape_api_key)
if ape_api_key and os.path.exists(key_path):
logging.debug('Set APE_API_KEY: %s', ape_api_key)
- os.environ['APE_API_KEY'] = ape_api_key
+ os.environ['APE_API_KEY'] = key_path
else:
logging.debug('APE_API_KEY not set, some GTS tests may fail'
' without authentication.')
diff --git a/atest/test_runners/atest_tf_test_runner_unittest.py b/atest/test_runners/atest_tf_test_runner_unittest.py
index d1968e8..5344ba0 100755
--- a/atest/test_runners/atest_tf_test_runner_unittest.py
+++ b/atest/test_runners/atest_tf_test_runner_unittest.py
@@ -306,13 +306,13 @@
self.tr._try_set_gts_authentication_key()
mock_exist.assert_not_called()
- @mock.patch('constants.GTS_GOOGLE_SERVICE_ACCOUNT')
- @mock.patch('os.path.exists')
- def test_try_set_gts_authentication_key_not_set(self, mock_exist, mock_key):
+ @mock.patch('os.path.join', return_value='/tmp/file_not_exist.json')
+ def test_try_set_gts_authentication_key_not_set(self, _):
"""Test try_set_authentication_key_not_set method."""
- # Test key neither exists nor set by user.
- mock_exist.return_value = False
- mock_key.return_value = ''
+ # Delete the environment variable if it's set. This is fine for this
+ # method because it's for validating the APE_API_KEY isn't set.
+ if os.environ.get('APE_API_KEY'):
+ del os.environ['APE_API_KEY']
self.tr._try_set_gts_authentication_key()
self.assertEqual(os.environ.get('APE_API_KEY'), None)
diff --git a/proto/test_record.proto b/proto/test_record.proto
index 96553c7..6f5a6ae 100644
--- a/proto/test_record.proto
+++ b/proto/test_record.proto
@@ -127,4 +127,7 @@
// A free-formed text that can help debugging the issue at hand.
string debug_help_message = 10;
-}
\ No newline at end of file
+
+ // The fully-qualified name of the exception class associated with the error.
+ string error_type = 20;
+}