| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Unit tests for tools/count.py.""" | |
| 7 | |
| 8 import os | |
| 9 import sys | |
| 10 import unittest | |
| 11 | |
| 12 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| 13 PROJECT_DIR = os.path.join(ROOT_DIR, '..') | |
| 14 sys.path.insert(0, PROJECT_DIR) | |
| 15 | |
| 16 | |
| 17 import find_depot_tools # pylint: disable=W0611 | |
| 18 import subprocess2 | |
| 19 | |
| 20 | |
| 21 class TestCount(unittest.TestCase): | |
| 22 def test_2011_04_09(self): | |
| 23 # Verifies commits done on that day. | |
| 24 # TODO(maruel): Import directly and do not use live data. | |
| 25 expected = ( | |
| 26 "Getting data from 2011-04-09 for 1 days\n" | |
| 27 "Top users: 3 out of 3 total users 100.00%\n" | |
| 28 " Committed 3 out of 3 CQ'ed commits 100.00%\n" | |
| 29 "\n" | |
| 30 "Total commits: 26\n" | |
| 31 "Total commits by commit bot: 3 ( 11.5%)\n") | |
| 32 exe_path = os.path.join(PROJECT_DIR, 'tools', 'count.py') | |
| 33 args = [sys.executable, exe_path, '-s', '2011-04-09', '-d', '1', '-o'] | |
| 34 self.assertEqual(expected, subprocess2.check_output(args)) | |
| 35 | |
| 36 | |
| 37 if __name__ == '__main__': | |
| 38 unittest.main() | |
| OLD | NEW |