Index: components/test/data/password_manager/automated_tests/run_tests.py |
diff --git a/components/test/data/password_manager/automated_tests/run_tests.py b/components/test/data/password_manager/automated_tests/run_tests.py |
index 0fea5077e7a40acf50a0af84ef748193647fc525..4e05853faeb56b3844997796417c09724166b747 100644 |
--- a/components/test/data/password_manager/automated_tests/run_tests.py |
+++ b/components/test/data/password_manager/automated_tests/run_tests.py |
@@ -26,6 +26,7 @@ import argparse |
import httplib2 |
import oauth2client.tools |
import os |
+import subprocess |
import tempfile |
from environment import Environment |
@@ -35,14 +36,14 @@ _CREDENTIAL_SCOPES = "https://spreadsheets.google.com/feeds" |
# TODO(melandory): Function _authenticate belongs to separate module. |
def _authenticate(pkey, client_email): |
-""" Authenticates user. |
+ """ Authenticates user. |
- Args: |
- pkey: Full path to file with private key generated by Google |
- Developer Console. |
- client_email: Email address corresponding to private key and also |
- generated by Google Developer Console. |
-""" |
+ Args: |
+ pkey: Full path to file with private key generated by Google |
+ Developer Console. |
+ client_email: Email address corresponding to private key and also |
+ generated by Google Developer Console. |
+ """ |
http, token = None, None |
with open(pkey) as pkey_file: |
private_key = pkey_file.read() |
@@ -99,8 +100,7 @@ def _try_run_individual_test(test_cmd, results_path): |
# Wait() in websitetest.py). Accounting for some more time spent on |
# the non-waiting execution, 300 seconds should be the upper bound on |
# the runtime of one pass, thus 600 seconds for the whole test. |
- # TODO(vabr): Use subprocess.call. |
- os.system("timeout 600 %s" % test_cmd) |
+ subprocess.call(["timeout", "600"] + test_cmd) |
if os.path.isfile(results_path): |
results = open(results_path, "r") |
count = 0 # Count the number of successful tests. |
@@ -152,16 +152,14 @@ def run_tests( |
tests_path = os.path.join(tests_dir, "tests.py") |
for websitetest in environment.websitetests: |
- test_cmd = ("python %s %s --chrome-path %s " |
- "--chromedriver-path %s" |
- "--passwords-path %s --profile-path %s " |
- "--save-path %s" % |
- (tests_path, websitetest.name, chrome_path, |
- chromedriver_path, |
- config.get("data_files", "passwords_path"), |
- profile_path, results_path)) |
- status, log = _try_run_individual_test( |
- websitetest, test_cmd, results_path) |
+ test_cmd = ["python", tests_path, websitetest.name, |
+ "--chrome-path", chrome_path, |
+ "--chromedriver-path", chromedriver_path, |
+ "--passwords-path", |
+ config.get("data_files", "passwords_path"), |
+ "--profile-path", profile_path, |
+ "--save-path", results_path] |
+ status, log = _try_run_individual_test(test_cmd, results_path) |
try: |
sheet.InsertRow(sheet.row_count, |
[websitetest.name, status, date, " | ".join(log)]) |