[PATCH 1 of 3 TMP] run-test: restore the -i prompt by write .err before checking if it exists

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat May 17 03:09:19 CDT 2014


This series of three patches fixes the current issue with --interactive 
on default.

However, as there is much more patch from Greg coming it may be wiser to 
pushed greg patch instead of introduction octolion of conflict with this 
tree patches.

The patch are posted here for people that need them immediatly and to 
highly existing errors to Greg.

On 05/17/2014 01:07 AM, pierre-yves.david at ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1400312226 25200
> #      Sat May 17 00:37:06 2014 -0700
> # Node ID 2e0e35c50422fbff720b8dcf5ea65d044b44a554
> # Parent  8ff84d8b66e20e137b47f6e102fea5dddf8c7d4f
> run-test: restore the -i prompt by write .err before checking if it exists
>
> The `--interactive` flag workis by overwriting the original test file by its
> `.err` version. So we need to write it before calling `self.fail`. Otherwise the
> `.err` file does not exists and `--interactive` is ignored.
>
> We can move that block code around because it is dedicated to write changed
> output and we moves it in the try-except dedicated to handling changed output.
>
> Note that the flog is still badly broken after this change. But at least it crash
> instead of being ignored.
>
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -471,22 +471,22 @@ class Test(object):
>               if ret:
>                   msg += 'output changed and ' + describe(ret)
>               else:
>                   msg += 'output changed'
>
> +            if (ret != 0 or out != self._refout) and not skipped \
> +                and not options.debug:
> +                f = open(self._errpath, 'wb')
> +                for line in out:
> +                    f.write(line)
> +            f.close()
>               res = self.fail(msg, ret)
>           elif ret:
>               res = self.fail(describe(ret), ret)
>           else:
>               res = self.success()
>
> -        if (ret != 0 or out != self._refout) and not skipped \
> -            and not options.debug:
> -            f = open(self._errpath, 'wb')
> -            for line in out:
> -                f.write(line)
> -            f.close()
>
>           vlog("# Ret was:", ret)
>
>           if not options.verbose:
>               iolock.acquire()
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list