[PATCH] run-tests: make --interactive work with --view
Gregory Szorc
gregory.szorc at gmail.com
Sun Aug 31 05:23:10 CDT 2014
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1409480564 -7200
# Sun Aug 31 12:22:44 2014 +0200
# Node ID 493125924ae208e30c1938300cf2dabc24a8e70d
# Parent 188b8aa2120b03eead618ba150319074f4e3b42b
run-tests: make --interactive work with --view
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1200,20 +1200,20 @@ class TestResult(unittest._TextTestResul
for line in lines:
self.stream.write(line)
self.stream.flush()
- # handle interactive prompt without releasing iolock
- if self._options.interactive:
- self.stream.write('Accept this change? [n] ')
- answer = sys.stdin.readline().strip()
- if answer.lower() in ('y', 'yes'):
- if test.name.endswith('.t'):
- rename(test.errpath, test.path)
- else:
- rename(test.errpath, '%s.out' % test.path)
- accepted = True
- if not accepted and not failed:
- self.faildata[test.name] = ''.join(lines)
+ # handle interactive prompt without releasing iolock
+ if self._options.interactive:
+ self.stream.write('Accept this change? [n] ')
+ answer = sys.stdin.readline().strip()
+ if answer.lower() in ('y', 'yes'):
+ if test.name.endswith('.t'):
+ rename(test.errpath, test.path)
+ else:
+ rename(test.errpath, '%s.out' % test.path)
+ accepted = True
+ if not accepted and not failed:
+ self.faildata[test.name] = ''.join(lines)
iolock.release()
return accepted
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -250,8 +250,20 @@ Refuse the fix
rataxes
This is a noop statement so that
this test is still more bytes than success.
+Interactive with custom view
+
+ $ echo 'n' | $TESTDIR/run-tests.py --with-hg=`which hg` -i --view echo
+ $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
+ Accept this change? [n]* (glob)
+ ERROR: test-failure.t output changed
+ !.
+ Failed test-failure.t: output changed
+ # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
+ python hash seed: * (glob)
+ [1]
+
View the fix
$ echo 'y' | $TESTDIR/run-tests.py --with-hg=`which hg` --view echo
$TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
More information about the Mercurial-devel
mailing list