# HG changeset patch # User Taapas Agrawal # Date 2019-01-13 12:26:02 # Node ID 8633c716f90846470f90cb379cd35afafe1db83e # Parent 704a3aa3dc0adb9e09078d0da3c512fe46abd1c5 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 diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -368,30 +368,11 @@ When backup-bundle config option is set: ========================================== 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