[PATCH] test-bundle2-format.t: force gc so a GeneratorExit will be thrown

Augie Fackler raf at durin42.com
Tue Dec 29 16:55:21 CST 2015


On Tue, Dec 22, 2015 at 10:47:09PM -0800, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bos at serpentine.com>
> # Date 1450853226 28800
> #      Tue Dec 22 22:47:06 2015 -0800
> # Node ID b74ccb8db88fb4f333061215d67dba5065bc56ab
> # Parent  079eba011d07eb82319082116528abddb6a7b178
> test-bundle2-format.t: force gc so a GeneratorExit will be thrown
>
> PyPy has looser semantics than CPython for when a generator's close
> method will be called.  Forcing the gc causes it to be called at
> the right moment.

I'm a little weirded out by this fix, because it worries me that it is
going to choke us in weird ways in production. Can you allay that fear at all?

>
> diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t
> --- a/tests/test-bundle2-format.t
> +++ b/tests/test-bundle2-format.t
> @@ -13,7 +13,7 @@ Create an extension to test bundle2 API
>    > code. We still need to be able to test it while it grow up.
>    > """
>    >
> -  > import sys, os
> +  > import sys, os, gc
>    > from mercurial import cmdutil
>    > from mercurial import util
>    > from mercurial import bundle2
> @@ -158,6 +158,7 @@ Create an extension to test bundle2 API
>    >                 # too zealous. It's important for this test that the break
>    >                 # occur while we're in the middle of a part.
>    >                 break
> +  >         gc.collect()
>    >         ui.write('fake timeout complete.\n')
>    >         return
>    >     try:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list