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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing_support/git_test_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_common_test.py
diff --git a/tests/git_common_test.py b/tests/git_common_test.py
index ef411ce9dab51ffb9c807eed301c910cbbad8725..76a91520dcee4ec73a67d31385725665ac6be6c0 100755
--- a/tests/git_common_test.py
+++ b/tests/git_common_test.py
@@ -772,6 +772,33 @@ class GitMakeWorkdir(git_test_utils.GitRepoReadOnlyTestBase, GitCommonTestBase):
self.assertFalse(os.path.islink(os.path.join(workdir, '.git', 'HEAD')))
+class GitTestUtilsTest(git_test_utils.GitRepoReadOnlyTestBase):
+ REPO_SCHEMA = """
+ A B
+ """
+
+ COMMIT_A = {
+ 'file1': {'data': 'file1'},
+ }
+
+ COMMIT_B = {
+ 'file1': {'data': 'file1 changed'},
+ }
+
+ def testAutomaticCommitDates(self):
+ # The dates should start from 1970-01-01 and automatically increment. They
+ # must be in UTC (otherwise the tests are system-dependent, and if your
+ # local timezone is positive, timestamps will be <0 which causes bizarre
+ # behaviour in Git; http://crbug.com/581895).
+ self.assertEquals('Author McAuthorly 1970-01-01 00:00:00 +0000',
+ self.repo.show_commit('A', format_string='%an %ai'))
+ self.assertEquals('Charles Committish 1970-01-02 00:00:00 +0000',
+ self.repo.show_commit('A', format_string='%cn %ci'))
+ self.assertEquals('Author McAuthorly 1970-01-03 00:00:00 +0000',
+ self.repo.show_commit('B', format_string='%an %ai'))
+ self.assertEquals('Charles Committish 1970-01-04 00:00:00 +0000',
+ self.repo.show_commit('B', format_string='%cn %ci'))
+
if __name__ == '__main__':
sys.exit(coverage_utils.covered_main(
« 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