tests: replace mockmakedate function in test-amend.t
authorTaapas Agrawal <taapas2897@gmail.com>
Sun, 13 Jan 2019 17:56:02 +0530
changeset 41214 8633c716f908
parent 41213 704a3aa3dc0a
child 41215 6242a19004ca
tests: replace mockmakedate function in test-amend.t This is a follow up patch for D5554. This replaces mockmakedate function by `tests/mockmakedate.py`. Differential Revision: https://phab.mercurial-scm.org/D5577
tests/test-amend.t
--- a/tests/test-amend.t	Thu Jan 10 20:11:19 2019 +0530
+++ b/tests/test-amend.t	Sun Jan 13 17:56:02 2019 +0530
@@ -368,30 +368,11 @@
 ==========================================
 Test update-timestamp config option|
 ==========================================
-  $ cat >> testmocks.py << EOF
-  > # mock out util.makedate() to supply testable values
-  > import os
-  > from mercurial import pycompat, util
-  > from mercurial.utils import dateutil
-  > 
-  > def mockmakedate():
-  >     filename = os.path.join(os.environ['TESTTMP'], 'testtime')
-  >     try:
-  >         with open(filename, 'rb') as timef:
-  >             time = float(timef.read()) + 1
-  >     except IOError:
-  >         time = 0.0
-  >     with open(filename, 'wb') as timef:
-  >         timef.write(pycompat.bytestr(time))
-  >     return (time, 0)
-  > 
-  > dateutil.makedate = mockmakedate
-  > EOF
 
   $ cat >> $HGRCPATH << EOF
   > [extensions]
   > amend=
-  > testmocks=`pwd`/testmocks.py
+  > mockmakedate = $TESTDIR/mockmakedate.py
   > EOF
 
   $ hg init $TESTTMP/repo5