Mercurial > hg
view tests/mockmakedate.py @ 41335:b81ca9a3f4e4
py3: port test-batching.py to python3
I used byteify-strings.py on this file, then manually added the
various pycompat and bprint bits as needed.
Differential Revision: https://phab.mercurial-scm.org/D5678
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 24 Jan 2019 11:35:40 -0500 |
parents | 704a3aa3dc0a |
children | 2372284d9457 |
line wrap: on
line source
# 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