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

Unified Diff: Tools/TestResultServer/model/jsonresults_unittest.py

Issue 14562007: Change TestResultServer to use python 2.7. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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
Index: Tools/TestResultServer/model/jsonresults_unittest.py
diff --git a/Tools/TestResultServer/model/jsonresults_unittest.py b/Tools/TestResultServer/model/jsonresults_unittest.py
index 0e65d0bf28f18e45d46eea5c0c26aac5f0289620..969f9b40ff4b982a6b2ab030d12090c0c6326ada 100755
--- a/Tools/TestResultServer/model/jsonresults_unittest.py
+++ b/Tools/TestResultServer/model/jsonresults_unittest.py
@@ -33,8 +33,7 @@ except ImportError:
print "ERROR: Add the TestResultServer, google_appengine and yaml/lib directories to your PYTHONPATH"
raise
-from django.utils import simplejson
-
+import json
import unittest
@@ -81,9 +80,9 @@ class JsonResultsTest(unittest.TestCase):
self._builder = "Webkit"
def test_strip_prefix_suffix(self):
- json = "['contents']"
- self.assertEqual(JsonResults._strip_prefix_suffix("ADD_RESULTS(" + json + ");"), json)
- self.assertEqual(JsonResults._strip_prefix_suffix(json), json)
+ json_string = "['contents']"
+ self.assertEqual(JsonResults._strip_prefix_suffix("ADD_RESULTS(" + json_string + ");"), json_string)
+ self.assertEqual(JsonResults._strip_prefix_suffix(json_string), json_string)
def _make_test_json(self, test_data):
if not test_data:
@@ -94,7 +93,7 @@ class JsonResultsTest(unittest.TestCase):
if not builds or not tests:
return ""
- json = JSON_RESULTS_TEMPLATE
+ json_string = JSON_RESULTS_TEMPLATE
counts = []
build_numbers = []
@@ -108,17 +107,17 @@ class JsonResultsTest(unittest.TestCase):
chrome_revision.append("3000%s" % build)
times.append("100000%s000" % build)
- json = json.replace("[TESTDATA_COUNTS]", ",".join(counts))
- json = json.replace("[TESTDATA_COUNT]", ",".join(builds))
- json = json.replace("[TESTDATA_BUILDNUMBERS]", ",".join(build_numbers))
- json = json.replace("[TESTDATA_WEBKITREVISION]", ",".join(webkit_revision))
- json = json.replace("[TESTDATA_CHROMEREVISION]", ",".join(chrome_revision))
- json = json.replace("[TESTDATA_TIMES]", ",".join(times))
+ json_string = json_string.replace("[TESTDATA_COUNTS]", ",".join(counts))
+ json_string = json_string.replace("[TESTDATA_COUNT]", ",".join(builds))
+ json_string = json_string.replace("[TESTDATA_BUILDNUMBERS]", ",".join(build_numbers))
+ json_string = json_string.replace("[TESTDATA_WEBKITREVISION]", ",".join(webkit_revision))
+ json_string = json_string.replace("[TESTDATA_CHROMEREVISION]", ",".join(chrome_revision))
+ json_string = json_string.replace("[TESTDATA_TIMES]", ",".join(times))
version = str(test_data["version"]) if "version" in test_data else "4"
- json = json.replace("[VERSION]", version)
- json = json.replace("{[TESTDATA_TESTS]}", simplejson.dumps(tests, separators=(',', ':'), sort_keys=True))
- return json
+ json_string = json_string.replace("[VERSION]", version)
+ json_string = json_string.replace("{[TESTDATA_TESTS]}", json.dumps(tests, separators=(',', ':'), sort_keys=True))
+ return json_string
def _test_merge(self, aggregated_data, incremental_data, expected_data, max_builds=jsonresults.JSON_RESULTS_MAX_BUILDS):
aggregated_results = self._make_test_json(aggregated_data)
@@ -133,7 +132,7 @@ class JsonResultsTest(unittest.TestCase):
def _test_get_test_list(self, input_data, expected_data):
input_results = self._make_test_json(input_data)
- expected_results = JSON_RESULTS_TEST_LIST_TEMPLATE.replace("{[TESTDATA_TESTS]}", simplejson.dumps(expected_data, separators=(',', ':')))
+ expected_results = JSON_RESULTS_TEST_LIST_TEMPLATE.replace("{[TESTDATA_TESTS]}", json.dumps(expected_data, separators=(',', ':')))
actual_results = JsonResults.get_test_list(self._builder, input_results)
self.assertEqual(actual_results, expected_results)
« Tools/TestResultServer/handlers/menu.py ('K') | « Tools/TestResultServer/model/jsonresults.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698