summaryrefslogtreecommitdiffstats
path: root/tools/grit
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 18:52:49 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 18:52:49 +0000
commitfe1b4d32560eebf5d509debecbfa4b72373ae458 (patch)
treea0003022acab4233653ec2cb6b041fea3fd781a5 /tools/grit
parent25f3e4150baad0a5a0fc2791289a6add26307c53 (diff)
downloadchromium_src-fe1b4d32560eebf5d509debecbfa4b72373ae458.zip
chromium_src-fe1b4d32560eebf5d509debecbfa4b72373ae458.tar.gz
chromium_src-fe1b4d32560eebf5d509debecbfa4b72373ae458.tar.bz2
Make sure grit unittests run on presubmit.
Previously, the return code was always 0 so the tests were always passing. Actually return an error code now. Also fix some tests that regressed in r83897 and r78357. Review URL: http://codereview.chromium.org/6929016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/grit')
-rw-r--r--tools/grit/grit/format/rc_unittest.py8
-rw-r--r--tools/grit/grit/gather/policy_json_unittest.py9
-rw-r--r--tools/grit/grit/test_suite_all.py7
3 files changed, 10 insertions, 14 deletions
diff --git a/tools/grit/grit/format/rc_unittest.py b/tools/grit/grit/format/rc_unittest.py
index 0599baa..976b71c 100644
--- a/tools/grit/grit/format/rc_unittest.py
+++ b/tools/grit/grit/format/rc_unittest.py
@@ -1,5 +1,5 @@
-#!/usr/bin/python2.4
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+#!/usr/bin/env python
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -185,7 +185,7 @@ END'''.strip()
def testRcIncludeFlattenedHtmlFile(self):
input_file = util.PathFromRoot('grit/test/data/include_test.html')
- output_file = '%s/include_test.html' % tempfile.gettempdir()
+ output_file = '%s/HTML_FILE1_include_test.html' % tempfile.gettempdir()
root = grd_reader.Parse(StringIO.StringIO('''
<includes>
<include name="HTML_FILE1" flattenhtml="true" file="%s" type="BINDATA" />
@@ -197,7 +197,7 @@ END'''.strip()
buf)
output = buf.getvalue()
- expected = u'HTML_FILE1 BINDATA "include_test.html"'
+ expected = u'HTML_FILE1 BINDATA "HTML_FILE1_include_test.html"'
# hackety hack to work on win32&lin
output = re.sub('"[c-zC-Z]:', '"', output)
self.failUnless(output.strip() == expected)
diff --git a/tools/grit/grit/gather/policy_json_unittest.py b/tools/grit/grit/gather/policy_json_unittest.py
index 9f141d6..9ebddb8 100644
--- a/tools/grit/grit/gather/policy_json_unittest.py
+++ b/tools/grit/grit/gather/policy_json_unittest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -25,7 +25,7 @@ class PolicyJsonUnittest(unittest.TestCase):
return expected
def testEmpty(self):
- original = "{'policy_definitions': [], 'placeholders': [], 'messages': {}}"
+ original = "{'policy_definitions': [], 'messages': {}}"
gatherer = policy_json.PolicyJson(original)
gatherer.Parse()
self.failUnless(len(gatherer.GetCliques()) == 0)
@@ -46,7 +46,6 @@ class PolicyJsonUnittest(unittest.TestCase):
" 'label': 'nothing special 3',"
" },"
" ],"
- " 'placeholders': [],"
" 'messages': {"
" 'msg_identifier': {"
" 'text': 'nothing special 3',"
@@ -74,7 +73,6 @@ class PolicyJsonUnittest(unittest.TestCase):
" ]"
" },"
" ],"
- " 'placeholders': [],"
" 'messages': {}"
"}")
gatherer = policy_json.PolicyJson(original)
@@ -96,7 +94,6 @@ class PolicyJsonUnittest(unittest.TestCase):
" ]"
" },"
" ],"
- " 'placeholders': [],"
" 'messages': {}"
"}")
gatherer = policy_json.PolicyJson(original)
@@ -108,7 +105,6 @@ class PolicyJsonUnittest(unittest.TestCase):
def testEscapingAndLineBreaks(self):
original = """{
'policy_definitions': [],
- 'placeholders': [],
'messages': {
'msg1': {
# The following line will contain two backslash characters when it
@@ -158,7 +154,6 @@ with a newline?''',
<ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.''',
},
],
- 'placeholders': [],
'messages': {}
}"""
gatherer = policy_json.PolicyJson(original)
diff --git a/tools/grit/grit/test_suite_all.py b/tools/grit/grit/test_suite_all.py
index df11bf0..e0f9b77 100644
--- a/tools/grit/grit/test_suite_all.py
+++ b/tools/grit/grit/test_suite_all.py
@@ -1,5 +1,5 @@
-#!/usr/bin/python2.4
-# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+#!/usr/bin/env python
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -85,4 +85,5 @@ class TestSuiteAll(unittest.TestSuite):
if __name__ == '__main__':
- unittest.TextTestRunner(verbosity=2).run(TestSuiteAll())
+ test_result = unittest.TextTestRunner(verbosity=2).run(TestSuiteAll())
+ sys.exit(len(test_result.errors) + len(test_result.failures))