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

Side by Side Diff: tests/main_test.py

Issue 47623004: chromium-status: tests: handle -vv and -vvv flags (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/chromium-status
Patch Set: switch to optparse Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import hashlib 6 import hashlib
7 import json 7 import json
8 import logging 8 import logging
9 import optparse
9 import os 10 import os
10 import re 11 import re
11 import sys 12 import sys
12 import unittest 13 import unittest
13 import urllib2 14 import urllib2
14 15
15 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 16 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
16 17
17 import fill 18 import fill
18 import local_gae 19 import local_gae
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 self._check_post_thru_ui() 352 self._check_post_thru_ui()
352 # Verify the config now shows True. 353 # Verify the config now shows True.
353 result = self.local_gae.query( 354 result = self.local_gae.query(
354 'import base_page\n' 355 'import base_page\n'
355 'q = base_page.GlobalConfig.all()\n' 356 'q = base_page.GlobalConfig.all()\n'
356 'assert q.count() == 1\n' 357 'assert q.count() == 1\n'
357 'print q.get().public_access\n') 358 'print q.get().public_access\n')
358 self.assertEqual('True\n', result) 359 self.assertEqual('True\n', result)
359 360
360 361
362 def _init_logging(argv):
363 """Set up our logging by re-using some of the unittest flags"""
364 parser = optparse.OptionParser()
365 parser.add_option('-v', action='count', default=0)
366 (opts, _) = parser.parse_args([x for x in argv if x.startswith('-v')])
367
368 levels = [logging.WARNING, logging.INFO, logging.DEBUG]
369 logging.basicConfig(level=levels[min(2, opts.v)])
370
371
361 if __name__ == '__main__': 372 if __name__ == '__main__':
362 logging.basicConfig(level= 373 _init_logging(sys.argv)
363 [logging.WARNING, logging.INFO, logging.DEBUG][
364 min(2, sys.argv.count('-v'))])
365 unittest.main() 374 unittest.main()
OLDNEW
« 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