tests/mockmakedate.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sat, 06 Mar 2021 06:32:25 +0100
changeset 46639 88bd085cf2f8
parent 43076 2372284d9457
child 48875 6000f5b25c9b
permissions -rw-r--r--
releasenotes: use the right API to access the 'sections' Preventing direct access to the underlying dict fix a breakage introduced by the refactoring in d3df397e7a59. This changeset is similar to 271dfcb98544, 5272542196cc and f7621fa14b84. The breackage of `releasenotes.py` stayed under my radar as the CI did not have fuzzywuzzy installed. (Something that is about to be fixed). Differential Revision: https://phab.mercurial-scm.org/D10121

# mock out util.makedate() to supply testable values

from __future__ import absolute_import

import os

from mercurial import pycompat
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