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

Side by Side Diff: typ/tests/main_test.py

Issue 2693503003: Add test times to the JSON results. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « typ/tests/json_results_test.py ('k') | 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 # Copyright 2014 Dirk Pranke. All rights reserved. 1 # Copyright 2014 Dirk Pranke. All rights reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 def test_version(self): 699 def test_version(self):
700 self.check('--version', ret=0, out=(VERSION + '\n')) 700 self.check('--version', ret=0, out=(VERSION + '\n'))
701 701
702 def test_write_full_results_to(self): 702 def test_write_full_results_to(self):
703 _, _, _, files = self.check(['--write-full-results-to', 703 _, _, _, files = self.check(['--write-full-results-to',
704 'results.json'], files=PASS_TEST_FILES) 704 'results.json'], files=PASS_TEST_FILES)
705 self.assertIn('results.json', files) 705 self.assertIn('results.json', files)
706 results = json.loads(files['results.json']) 706 results = json.loads(files['results.json'])
707 self.assertEqual(results['interrupted'], False) 707 self.assertEqual(results['interrupted'], False)
708 self.assertEqual(results['path_delimiter'], '.') 708 self.assertEqual(results['path_delimiter'], '.')
709
710 # The time it takes to run the test varies, so we test that
711 # we got a single entry greater than zero, but then delete it from
712 # the result so we can do an exact match on the rest of the trie.
713 result = results['tests']['pass_test']['PassingTest']['test_pass']
714 self.assertEqual(len(result['times']), 1)
715 self.assertGreater(result['times'][0], 0)
716 result.pop('times')
709 self.assertEqual(results['tests'], 717 self.assertEqual(results['tests'],
710 {u'pass_test': { 718 {u'pass_test': {
711 u'PassingTest': { 719 u'PassingTest': {
712 u'test_pass': { 720 u'test_pass': {
713 u'actual': u'PASS', 721 u'actual': u'PASS',
714 u'expected': u'PASS', 722 u'expected': u'PASS',
715 } 723 }
716 } 724 }
717 }}) 725 }})
718 726
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 modules_to_unload.append(k) 764 modules_to_unload.append(k)
757 for k in modules_to_unload: 765 for k in modules_to_unload:
758 del sys.modules[k] 766 del sys.modules[k]
759 sys.path = orig_sys_path 767 sys.path = orig_sys_path
760 768
761 return ret, out, err 769 return ret, out, err
762 770
763 def test_debugger(self): 771 def test_debugger(self):
764 # TODO: this test seems to hang under coverage. 772 # TODO: this test seems to hang under coverage.
765 pass 773 pass
OLDNEW
« no previous file with comments | « typ/tests/json_results_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698