Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG1d26f745a10b: py3: use pycompat.bytestr in test-journal.t
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Tests for the journal extension; records bookmark locations. | Tests for the journal extension; records bookmark locations. | ||||
$ cat >> testmocks.py << EOF | $ cat >> testmocks.py << EOF | ||||
> # mock out procutil.getuser() and util.makedate() to supply testable values | > # mock out procutil.getuser() and util.makedate() to supply testable values | ||||
> import os | > import os | ||||
> from mercurial import util | > from mercurial import util, pycompat | ||||
> from mercurial.utils import dateutil, procutil | > from mercurial.utils import dateutil, procutil | ||||
> def mockgetuser(): | > def mockgetuser(): | ||||
> return 'foobar' | > return 'foobar' | ||||
> | > | ||||
> def mockmakedate(): | > def mockmakedate(): | ||||
> filename = os.path.join(os.environ['TESTTMP'], 'testtime') | > filename = os.path.join(os.environ['TESTTMP'], 'testtime') | ||||
> try: | > try: | ||||
> with open(filename, 'rb') as timef: | > with open(filename, 'rb') as timef: | ||||
> time = float(timef.read()) + 1 | > time = float(timef.read()) + 1 | ||||
> except IOError: | > except IOError: | ||||
> time = 0.0 | > time = 0.0 | ||||
> with open(filename, 'wb') as timef: | > with open(filename, 'wb') as timef: | ||||
> timef.write(str(time)) | > timef.write(pycompat.bytestr(time)) | ||||
> return (time, 0) | > return (time, 0) | ||||
> | > | ||||
> procutil.getuser = mockgetuser | > procutil.getuser = mockgetuser | ||||
> dateutil.makedate = mockmakedate | > dateutil.makedate = mockmakedate | ||||
> EOF | > EOF | ||||
$ cat >> $HGRCPATH << EOF | $ cat >> $HGRCPATH << EOF | ||||
> [extensions] | > [extensions] |