Patchwork [03,of,12,stable] bundle2: make error testing more modular

login
register
mail settings
Submitter Pierre-Yves David
Date April 22, 2014, 8:10 p.m.
Message ID <d2ed7a2bc8301f7a7e5e.1398197447@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4423/
State Accepted
Commit 9a813e703172d65d8b63b21ec3c43bc79c575e57
Headers show

Comments

Pierre-Yves David - April 22, 2014, 8:10 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1398121195 25200
#      Mon Apr 21 15:59:55 2014 -0700
# Branch stable
# Node ID d2ed7a2bc8301f7a7e5e1c34175950206da27cc6
# Parent  32afe109f32541e1a56b15706bdf033defc39f15
bundle2: make error testing more modular

We have more than Abort to test.

Patch

diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t
--- a/tests/test-bundle2.t
+++ b/tests/test-bundle2.t
@@ -902,12 +902,16 @@  Setting up
   > from mercurial import exchange
   > from mercurial import extensions
   > 
   > def _pushbundle2failpart(orig, pushop, bundler):
   >     extradata = orig(pushop, bundler)
-  >     part = bundle2.bundlepart('test:abort')
-  >     bundler.addpart(part)
+  >     reason = pushop.ui.config('failpush', 'reason', None)
+  >     part = None
+  >     if reason == 'abort':
+  >         part = bundle2.bundlepart('test:abort')
+  >     if part is not None:
+  >         bundler.addpart(part)
   >     return extradata
   > 
   > @bundle2.parthandler("test:abort")
   > def handleabort(op, part):
   >     raise util.Abort('Abandon ship!', hint="don't panic")
@@ -936,10 +940,15 @@  Setting up
   $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
   $ cat other.pid >> $DAEMON_PIDS
 
 Doing the actual push: Abort error
 
+  $ cat << EOF >> $HGRCPATH
+  > [failpush]
+  > reason = abort
+  > EOF
+
   $ hg -R main push other -r e7ec4e813ba6
   pushing to other
   searching for changes
   abort: Abandon ship!
   (don't panic)