Patchwork test: don't rely on __del__ in test-devel-warnings.t

login
register
mail settings
Submitter Pierre-Yves David
Date April 5, 2016, 7:26 p.m.
Message ID <1727f38420c0fb1c37ce.1459884378@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/14388/
State Accepted
Headers show

Comments

Pierre-Yves David - April 5, 2016, 7:26 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Jun Wu - April 5, 2016, 7:33 p.m.
On 04/05/2016 08:26 PM, Pierre-Yves David wrote:
> test: don't rely on __del__ in test-devel-warnings.t

Should we print develwarn at __del__ then?
Pierre-Yves David - April 5, 2016, 7:51 p.m.
On 04/05/2016 12:33 PM, Jun Wu wrote:
> On 04/05/2016 08:26 PM, Pierre-Yves David wrote:
>> test: don't rely on __del__ in test-devel-warnings.t
>
> Should we print develwarn at __del__ then?

There is an on going discussion around this. Printing develwarn in 
__del__ could be one of the outcome. Thanks for thinking about it.

Cheers,
Augie Fackler - April 7, 2016, 1:24 a.m.
On Tue, Apr 05, 2016 at 12:26:18PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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

queued, thanks

>
> 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()
>    >
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

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()
   >