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

Side by Side Diff: tests/git_common_test.py

Issue 1640973002: git_test_utils: Automatic commit dates are now in UTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 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 | « testing_support/git_test_utils.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 """Unit tests for git_common.py""" 6 """Unit tests for git_common.py"""
7 7
8 import binascii 8 import binascii
9 import collections 9 import collections
10 import os 10 import os
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 EXPECTED_LINKS = [ 765 EXPECTED_LINKS = [
766 'config', 'info', 'hooks', 'logs/refs', 'objects', 'refs', 766 'config', 'info', 'hooks', 'logs/refs', 'objects', 'refs',
767 ] 767 ]
768 for path in EXPECTED_LINKS: 768 for path in EXPECTED_LINKS:
769 self.assertTrue(os.path.islink(os.path.join(workdir, '.git', path))) 769 self.assertTrue(os.path.islink(os.path.join(workdir, '.git', path)))
770 self.assertEqual(os.path.realpath(os.path.join(workdir, '.git', path)), 770 self.assertEqual(os.path.realpath(os.path.join(workdir, '.git', path)),
771 os.path.join(self.repo.repo_path, '.git', path)) 771 os.path.join(self.repo.repo_path, '.git', path))
772 self.assertFalse(os.path.islink(os.path.join(workdir, '.git', 'HEAD'))) 772 self.assertFalse(os.path.islink(os.path.join(workdir, '.git', 'HEAD')))
773 773
774 774
775 class GitTestUtilsTest(git_test_utils.GitRepoReadOnlyTestBase):
776 REPO_SCHEMA = """
777 A B
778 """
779
780 COMMIT_A = {
781 'file1': {'data': 'file1'},
782 }
783
784 COMMIT_B = {
785 'file1': {'data': 'file1 changed'},
786 }
787
788 def testAutomaticCommitDates(self):
789 # The dates should start from 1970-01-01 and automatically increment. They
790 # must be in UTC (otherwise the tests are system-dependent, and if your
791 # local timezone is positive, timestamps will be <0 which causes bizarre
792 # behaviour in Git; http://crbug.com/581895).
793 self.assertEquals('Author McAuthorly 1970-01-01 00:00:00 +0000',
794 self.repo.show_commit('A', format_string='%an %ai'))
795 self.assertEquals('Charles Committish 1970-01-02 00:00:00 +0000',
796 self.repo.show_commit('A', format_string='%cn %ci'))
797 self.assertEquals('Author McAuthorly 1970-01-03 00:00:00 +0000',
798 self.repo.show_commit('B', format_string='%an %ai'))
799 self.assertEquals('Charles Committish 1970-01-04 00:00:00 +0000',
800 self.repo.show_commit('B', format_string='%cn %ci'))
801
775 802
776 if __name__ == '__main__': 803 if __name__ == '__main__':
777 sys.exit(coverage_utils.covered_main( 804 sys.exit(coverage_utils.covered_main(
778 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py'))) 805 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py')))
OLDNEW
« no previous file with comments | « testing_support/git_test_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698