Patchwork [3,of,7,STABLE] test: factor out the "wait" logic in bookrace

login
register
mail settings
Submitter Pierre-Yves David
Date June 21, 2019, 2:04 a.m.
Message ID <62616ebca61fba1039e5.1561082650@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/40637/
State Accepted
Headers show

Comments

Pierre-Yves David - June 21, 2019, 2:04 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1560915967 -7200
#      Wed Jun 19 05:46:07 2019 +0200
# Branch stable
# Node ID 62616ebca61fba1039e50832078c24d13918e545
# Parent  c3ee35c586f85011ed7c8afad55a2e7d3ec7027b
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 62616ebca61f
test: factor out the "wait" logic in bookrace

The test is currently not testing the race it is supposed to test. The
synchronisation is still valid, but needs to run at a different point.

We start with extracting the synchronisation logic for clarity.

Patch

diff --git a/tests/test-bookmarks-corner-case.t b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -120,7 +120,8 @@  We build a server side extension for thi
   > import time
   > import atexit
   > from mercurial import error, extensions, bookmarks
-  > def wrapinit(orig, self, repo):
+  > 
+  > def wait():
   >     if not os.path.exists('push-A-started'):
   >         print('setting raced push up')
   >         with open('push-A-started', 'w'):
@@ -131,6 +132,9 @@  We build a server side extension for thi
   >         if clock <= 0:
   >             raise error.Abort("race scenario timed out")
   >         time.sleep(0.1)
+  > 
+  > def wrapinit(orig, self, repo):
+  >     wait()
   >     return orig(self, repo)
   > def uisetup(ui):
   >     extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)