test-push-race: use 'ui.atexit' instead of python's 'atexit'
authorSaurabh Singh <singhsrb@fb.com>
Thu, 05 Oct 2017 20:46:49 +0000
changeset 34507 30ae924a9e00
parent 34506 1d804c22c671
child 34508 b521b3a79afd
test-push-race: use 'ui.atexit' instead of python's 'atexit' Callbacks registered with 'atexit' are sometimes not called (like when a process is killed by the SIGTERM signal). Therefore, this commit replaces it with 'ui.atexit' which ensures that the callbacks are always called. This also makes the test compatible with chg. Test Plan: Ran the test 'test-push-race.t' with and without the '--chg' option. Differential Revision: https://phab.mercurial-scm.org/D957
tests/test-push-race.t
--- a/tests/test-push-race.t	Mon Oct 02 04:48:06 2017 +0530
+++ b/tests/test-push-race.t	Thu Oct 05 20:46:49 2017 +0000
@@ -15,7 +15,6 @@
   > Client with the extensions will create a file when ready and get stuck until
   > a file is created."""
   > 
-  > import atexit
   > import errno
   > import os
   > import time
@@ -51,7 +50,7 @@
   >                 except OSError as exc:
   >                     if exc.errno != errno.ENOENT:
   >                         raise
-  >             atexit.register(delete)
+  >             ui.atexit(delete)
   >     return orig(pushop)
   > 
   > def uisetup(ui):