Submitter | Denis Laxalde |
---|---|
Date | Oct. 4, 2017, 11:15 a.m. |
Message ID | <bd07ebae31e368211e47.1507115758@sh77.tls.logilab.fr> |
Download | mbox | patch |
Permalink | /patch/24456/ |
State | Rejected |
Headers | show |
Comments
> On Oct 4, 2017, at 07:15, Denis Laxalde <denis@laxalde.org> wrote: > > # HG changeset patch > # User Denis Laxalde <denis.laxalde@logilab.fr> > # Date 1507115620 -7200 > # Wed Oct 04 13:13:40 2017 +0200 > # Node ID bd07ebae31e368211e47432b67efcb475332f821 > # Parent 2fd06499dc8e6a5a784b1334b925c289d7b54e4e > # Available At http://hg.logilab.org/users/dlaxalde/hg > # hg pull http://hg.logilab.org/users/dlaxalde/hg -r bd07ebae31e3 > # EXP-Topic run-tests-accept-all > run-tests: add a -A/--accept-all option to accept all changed outputs Convince we this is better than doing yes | python run-tests.py --interactive? I'm just hesitant to add features.
Augie Fackler a écrit : > >> On Oct 4, 2017, at 07:15, Denis Laxalde <denis@laxalde.org> wrote: >> >> # HG changeset patch >> # User Denis Laxalde <denis.laxalde@logilab.fr> >> # Date 1507115620 -7200 >> # Wed Oct 04 13:13:40 2017 +0200 >> # Node ID bd07ebae31e368211e47432b67efcb475332f821 >> # Parent 2fd06499dc8e6a5a784b1334b925c289d7b54e4e >> # Available At http://hg.logilab.org/users/dlaxalde/hg >> # hg pull http://hg.logilab.org/users/dlaxalde/hg -r bd07ebae31e3 >> # EXP-Topic run-tests-accept-all >> run-tests: add a -A/--accept-all option to accept all changed outputs > > Convince we this is better than doing yes | python run-tests.py --interactive? I'm just hesitant to add features. > It's not better, I just did not think about this. Now, I'll remember, thanks.
Patch
diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -323,6 +323,8 @@ def getparser(): help="create an HTML report of the coverage of the files") parser.add_option("-i", "--interactive", action="store_true", help="prompt to accept changed output") + parser.add_option("-A", "--accept-all", action="store_true", + help="accept all changed outputs") parser.add_option("-j", "--jobs", type="int", help="number of jobs to run in parallel" " (default: $%s or %d)" % defaults['jobs']) @@ -1740,20 +1742,25 @@ class TestResult(unittest._TextTestResul self.stream.flush() # handle interactive prompt without releasing iolock - if self._options.interactive: + if self._options.interactive or self._options.accept_all: if test.readrefout() != expected: self.stream.write( 'Reference output has changed (run again to prompt ' 'changes)') else: - self.stream.write('Accept this change? [n] ') - answer = sys.stdin.readline().strip() - if answer.lower() in ('y', 'yes'): + accepted = False + if self._options.accept_all: + accepted = True + else: + self.stream.write('Accept this change? [n] ') + answer = sys.stdin.readline().strip() + if answer.lower() in ('y', 'yes'): + accepted = True + if accepted: if test.path.endswith(b'.t'): rename(test.errpath, test.path) else: rename(test.errpath, '%s.out' % test.path) - accepted = True if not accepted: self.faildata[test.name] = b''.join(lines)