Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: components/test/data/password_manager/automated_tests/run_tests.py

Issue 884403002: [Password manager tests] Fix indentation bug & use subprocesses to run tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698