[PATCH] test: don't rely on __del__ in test-devel-warnings.t

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Apr 5 19:26:18 UTC 2016


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1459883985 25200
#      Tue Apr 05 12:19:45 2016 -0700
# Node ID 1727f38420c0fb1c37ce8ce95f897fe1d013b532
# Parent  1e97bcbb87767e1a96909900595a0b6a7791407b
# Available At http://mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull http://mercurial-scm.org/repo/users/marmoute/mercurial/ -r 1727f38420c0
# EXP-Topic develandgc
test: don't rely on __del__ in test-devel-warnings.t

Whatever the future of __del__ in Mercurial is, that devel-warning test is not
about testing the automatic transaction rollback and we should explicitly call
it.

This change make this tests pass with pypy, as pypy try less hard to call
__del__ at program exit.

diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t
+++ b/tests/test-devel-warnings.t
@@ -9,10 +9,12 @@
   > command = cmdutil.command(cmdtable)
   > 
   > @command('buggylocking', [], '')
   > def buggylocking(ui, repo):
   >     tr = repo.transaction('buggy')
+  >     # make sure we rollback the transaction as we don't want to rely on the__del__
+  >     tr.release()
   >     lo = repo.lock()
   >     wl = repo.wlock()
   >     wl.release()
   >     lo.release()
   > 


More information about the Mercurial-devel mailing list