[PATCH STABLE] test-command-template.t: make "age" filter test work on Feb 29th

Benoit Boissinot benoit.boissinot at ens-lyon.org
Wed Jan 2 07:00:24 CST 2013


# HG changeset patch
# User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
# Date 1357131547 -3600
# Branch stable
# Node ID 3b1005354440baa448207057149d8ba8765fe082
# Parent  cd64a8a2d0da5178de30105ff69ccff32a73a536
test-command-template.t: make "age" filter test work on Feb 29th

reported by Julien Cristau.

diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -1346,10 +1346,10 @@
 
   $ hg log --template '{date|age}\n' > /dev/null || exit 1
 
-  >>> from datetime import datetime
+  >>> from datetime import datetime, timedelta
   >>> fp = open('a', 'w')
-  >>> n = datetime.now()
-  >>> fp.write('%d-%d-%d 00:00' % ((n.year + 7), n.month, n.day))
+  >>> n = datetime.now() + timedelta(366 * 7)
+  >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
   >>> fp.close()
   $ hg add a
   $ hg commit -m future -d "`cat a`"


More information about the Mercurial-devel mailing list