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

Christian Theune <[email protected]>
Newsgroups gmane.comp.web.zope.zope3.cvs
Organization gocept gmbh & co. kg
Message-ID <1219908271.7563.25.camel@mindy>
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 <[email protected]>
>   
> 
> 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
> [email protected]
> http://mail.zope.org/mailman/listinfo/checkins
-- 
Christian Theune · [email protected]
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

_______________________________________________
Zope3-Checkins mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope3-checkins
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBItlKvdUt9X/gknwIRAu06AKCtwbHx175+M6mhj4EJ+Ap37yV3JACgsj/T
FZSxMdCbYevj5E7Mhc8ka4w=
=1pzM
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.