view tests/test-status-inprocess.py @ 21977:4ca4e1572022

run-tests: '--time' option provide more details to Linux users As our tests execute in child processes, this patch uses os.times() module in replace of time.time() module to provide additional info like user time and system time spent by child's processes along with real elapsed time taken by a process. There is one limitation of this patch. It can work only for Linux users and not for Windows. "os.times" module returns a 5-tuple of a floaing point numbers. 1) User time 2) System time 3) Child's user time 4) Child's system time 5) Ellapsed real time On Windows, only the first two items are filled, the others are zero. Therefore, below test cases does not break on Windows but instead gives the zero value.
author anuraggoel <anurag.dsps@gmail.com>
date Thu, 26 Jun 2014 01:22:50 +0530
parents 13a1b2fb7ef2
children 7779f9dfd938
line wrap: on
line source

#!/usr/bin/python
from mercurial.ui import ui
from mercurial.localrepo import localrepository
from mercurial.commands import add, commit, status

u = ui()

print '% creating repo'
repo = localrepository(u, '.', create=True)

f = open('test.py', 'w')
try:
    f.write('foo\n')
finally:
    f.close

print '% add and commit'
add(u, repo, 'test.py')
commit(u, repo, message='*')
status(u, repo, clean=True)


print '% change'
f = open('test.py', 'w')
try:
    f.write('bar\n')
finally:
    f.close()

# this would return clean instead of changed before the fix
status(u, repo, clean=True, modified=True)