changeset 42507:febf5c8215c1 stable

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 19 Jun 2019 05:46:07 +0200
parents cd73e51a1f8a
children c4d1807b165f
files tests/test-bookmarks-corner-case.t
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-bookmarks-corner-case.t	Wed Jun 19 05:45:44 2019 +0200
+++ b/tests/test-bookmarks-corner-case.t	Wed Jun 19 05:46:07 2019 +0200
@@ -120,7 +120,8 @@
   > 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 @@
   >         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)