[Zope3-checkins] [Checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner/runner.py Added a workaround for Jython to support a gargabe collector call.

Christian Theune ct at gocept.com
Thu Aug 28 03:24:31 EDT 2008


Hi again,

On Wed, 2008-08-27 at 19:54 -0400, Georgy Berdyshev wrote:
> Log message for revision 90511:
>   Added a workaround for Jython to support a gargabe collector call.
>   
>   Signed-off-by: Georgy Berdyshev - ?\208?\147?\208?\181?\208?\190?\209?\128?\208?\179?\208?\184?\208?\185 ?\208?\145?\208?\181?\209?\128?\208?\180?\209?\139?\209?\136?\208?\181?\208?\178 <codingmaster at gmail.com>
>   
> 
> Changed:
>   U   zope.testing/trunk/src/zope/testing/testrunner/runner.py

Same comment as to your zc.buildout checkin:

Platform independence through 'if_<isplatform>' is probably not going to
be maintainable, because others, not familiar with your platform are
probably going to break it.

One thing I could imagine is that we become more defensive regarding
some C-Python-specific modules. But I really don't like seeing all those
if-clauses in there.


-=-
> Modified: zope.testing/trunk/src/zope/testing/testrunner/runner.py
> ===================================================================
> --- zope.testing/trunk/src/zope/testing/testrunner/runner.py	2008-08-27 23:54:02 UTC (rev 90510)
> +++ zope.testing/trunk/src/zope/testing/testrunner/runner.py	2008-08-27 23:54:06 UTC (rev 90511)
> @@ -49,6 +49,7 @@
>  
>  PYREFCOUNT_PATTERN = re.compile('\[[0-9]+ refs\]')
>  
> +is_jython = sys.platform.startswith('java')
>  
>  class SubprocessError(Exception):
>      """An error occurred when running a subprocess
> @@ -178,8 +179,13 @@
>          self.features.append(zope.testing.testrunner.coverage.Coverage(self))
>          self.features.append(zope.testing.testrunner.doctest.DocTest(self))
>          self.features.append(zope.testing.testrunner.profiling.Profiling(self))
> -        self.features.append(zope.testing.testrunner.garbagecollection.Threshold(self))
> -        self.features.append(zope.testing.testrunner.garbagecollection.Debug(self))
> +        if is_jython:
> +            # Jython GC support is not yet implemented
> +            pass
> +        else:
> +            self.features.append(zope.testing.testrunner.garbagecollection.Threshold(self))
> +            self.features.append(zope.testing.testrunner.garbagecollection.Debug(self))
> +
>          self.features.append(zope.testing.testrunner.find.Find(self))
>          self.features.append(zope.testing.testrunner.subprocess.SubProcess(self))
>          self.features.append(zope.testing.testrunner.filter.Filter(self))
> @@ -240,8 +246,12 @@
>  
>      output = options.output
>  
> -    gc.collect()
> -    lgarbage = len(gc.garbage)
> +    if is_jython:
> +        # Jython has no GC suppport - set count to 0
> +        lgarbage = 0
> +    else:
> +        gc.collect()
> +        lgarbage = len(gc.garbage)
>  
>      sumrc = 0
>      if options.report_refcounts:
> @@ -301,10 +311,13 @@
>          output.summary(result.testsRun, len(result.failures), len(result.errors), t)
>          ran = result.testsRun
>  
> -        gc.collect()
> -        if len(gc.garbage) > lgarbage:
> -            output.garbage(gc.garbage[lgarbage:])
> -            lgarbage = len(gc.garbage)
> +        if is_jython:
> +            lgarbage = 0
> +        else:
> +            gc.collect()
> +            if len(gc.garbage) > lgarbage:
> +                output.garbage(gc.garbage[lgarbage:])
> +                lgarbage = len(gc.garbage)
>  
>          if options.report_refcounts:
>  
> @@ -618,10 +631,13 @@
>          self.testTearDown()
>          self.options.output.stop_test(test)
>  
> -        if gc.garbage:
> -            self.options.output.test_garbage(test, gc.garbage)
> -            # TODO: Perhaps eat the garbage here, so that the garbage isn't
> -            #       printed for every subsequent test.
> +        if is_jython:
> +            pass
> +        else:
> +            if gc.garbage:
> +                self.options.output.test_garbage(test, gc.garbage)
> +                # TODO: Perhaps eat the garbage here, so that the garbage isn't
> +                #       printed for every subsequent test.
>  
>          # Did the test leave any new threads behind?
>          new_threads = [t for t in threading.enumerate()
> 
> _______________________________________________
> Checkins mailing list
> Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/checkins
-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-checkins/attachments/20080828/3449e520/attachment.bin 


More information about the Zope3-Checkins mailing list