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

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Tue Apr 22 15:10:47 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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.

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)


More information about the Mercurial-devel mailing list