| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Run specific test on specific environment.""" | 5 """Run specific test on specific environment.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import tempfile | 10 import tempfile |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 env: Environment the tests will run in. | 34 env: Environment the tests will run in. |
| 35 test_instance: The test that will be run. | 35 test_instance: The test that will be run. |
| 36 """ | 36 """ |
| 37 super(RemoteDeviceTestRun, self).__init__(env, test_instance) | 37 super(RemoteDeviceTestRun, self).__init__(env, test_instance) |
| 38 self._env = env | 38 self._env = env |
| 39 self._test_instance = test_instance | 39 self._test_instance = test_instance |
| 40 self._app_id = '' | 40 self._app_id = '' |
| 41 self._test_id = '' | 41 self._test_id = '' |
| 42 self._results = '' | 42 self._results = '' |
| 43 | 43 |
| 44 def TestPackage(self): | |
| 45 pass | |
| 46 | |
| 47 #override | 44 #override |
| 48 def RunTests(self): | 45 def RunTests(self): |
| 49 """Run the test.""" | 46 """Run the test.""" |
| 50 if self._env.trigger: | 47 if self._env.trigger: |
| 51 test_start_res = appurify.api.tests_run( | 48 test_start_res = appurify.api.tests_run( |
| 52 self._env.token, self._env.device, self._app_id, self._test_id) | 49 self._env.token, self._env.device, self._app_id, self._test_id) |
| 53 remote_device_helper.TestHttpResponse( | 50 remote_device_helper.TestHttpResponse( |
| 54 test_start_res, 'Unable to run test.') | 51 test_start_res, 'Unable to run test.') |
| 55 test_run_id = test_start_res.json()['response']['test_run_id'] | 52 test_run_id = test_start_res.json()['response']['test_run_id'] |
| 56 if not self._env.collect: | 53 if not self._env.collect: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 with tempfile.TemporaryFile() as config: | 164 with tempfile.TemporaryFile() as config: |
| 168 config_data = ['[appurify]', '[%s]' % runner_type] | 165 config_data = ['[appurify]', '[%s]' % runner_type] |
| 169 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) | 166 config_data.extend('%s=%s' % (k, v) for k, v in body.iteritems()) |
| 170 config.write(''.join('%s\n' % l for l in config_data)) | 167 config.write(''.join('%s\n' % l for l in config_data)) |
| 171 config.flush() | 168 config.flush() |
| 172 config.seek(0) | 169 config.seek(0) |
| 173 config_response = appurify.api.config_upload(self._env.token, | 170 config_response = appurify.api.config_upload(self._env.token, |
| 174 config, self._test_id) | 171 config, self._test_id) |
| 175 remote_device_helper.TestHttpResponse(config_response, | 172 remote_device_helper.TestHttpResponse(config_response, |
| 176 'Unable to upload test config.') | 173 'Unable to upload test config.') |
| OLD | NEW |