Re: [Zope-dev] Zope Tests: 41 OK, 13 Failed

2010-12-19 Thread Marius Gedminas
On Sun, Dec 19, 2010 at 07:51:08PM +0200, Marius Gedminas wrote:
> On Sun, Dec 19, 2010 at 06:45:11PM +0200, Marius Gedminas wrote:
> > > Subject: FAILED : winbot / z3c.contents_py_265_32
> > > From: buildbot at winbot.zope.org
> > > Date: Sat Dec 18 23:06:16 EST 2010
> > > URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027073.html
> > 
> > Interesting.
> > 
> > c:\buildslave\z3c.contents\build\src\z3c\contents\README.txt, while testing
> > copy & paste near line 613, ends up deep in zope.copy.clone() which barfs
> > with
> > 
> > TypeError: non-picklable object
> 
> tl;dr: zope.copy is badly broken.
> 
> The test here creates a simple Content object:
> 
> class Content(object):
> """Sample content which is pickable for copy test."""
> 
> zope.interface.implements(IContent)
> 
> def __init__(self, title, number):
> self.title = title
> self.number = number
> 
> def __repr__(self):
> return u'<%s %s %s>' % (self.__class__.__name__, self.title,
> self.number)
> 
> It is not persistent, so it gets wrapped in a ContainedProxy.
> 
> And then z3c.contents does
> 
> copier = IObjectCopier(obj)
> copier.copyTo(self.context)
> 
> and zope.copypastemove.ObjectCopier.copyTo() does
> 
> new = copy(obj)
> 
> and zope.copy.copy() does
> 
> res = clone(obj)
> res.__parent__ = None # wrapped in an if and a try/except.
> 
> in that order, and zope.copy.clone() does
> 
> tmp = tempfile.TemporaryFile()
> persistent = CopyPersistent(obj)
> pickler = cPickle.Pickler(tmp, 2)
> pickler.persistent_id = persistent.id
> pickler.dump(obj)
> 
> which tries to pickle an unpickleable ViewPageTemplateFile.  Why?
> Because of it's reachable through this chain of references:
> http://mg.pov.lt/contained-proxy-pickles-too-much.png
> 
> Yes, copying any object with zope.copypastemove makes a copy of your
> entire ZODB contents, and then discards it a bit later, by dropping the
> __parent__ *after* copying it.
> 
> (I have a feeling of deja-vu here, but Google doesn't support me.)
> 
> I suppose setting __parent__ to None *before* copying is out of the
> question.  How about making pickler.persistent_id check the object against
> a blacklist -- containing the __parent__ we don't want to copy -- before
> passing it on to persistent.id?
> 
> I'll go file a bug at https://bugs.launchpad.net/zope.copy

Filed as https://bugs.launchpad.net/zope.copy/+bug/692280

I was curious what a TemplateFactory adapter was doing in the _local_
site, and then discovered that it was being registered inside
z3c.contents README.txt, via xmlconfig.string().

Apparently this worked just fine when ZCML directives used
getGlobalSiteManager() for their components, but now they use
getSiteManager() and you end up with nonpersistable adapters like
z3c.template's TemplateFactory in the local site.

I can get rid of the TypeError with this patch, but then the tests fail
because the search form is missing from the rendered HTML (why???):


Index: src/z3c/contents/README.txt
===
--- src/z3c/contents/README.txt (revision 119005)
+++ src/z3c/contents/README.txt (working copy)
@@ -46,6 +46,10 @@ also configure the template for the sear
   ... 'contents.pt')
   >>> searchTemplate = os.path.join(os.path.dirname(z3c.contents.__file__),
   ... 'search.pt')
+  >>> from zope.component.hooks import setSite, getSite
+  >>> site = getSite()
+  >>> setSite(None) # z3c:template adapters must be registered globally,
+  ...   # not in a site, as they're not pickleable
   >>> context = xmlconfig.string("""
   ... http://namespaces.zope.org/z3c";>
@@ -59,6 +63,7 @@ also configure the template for the sear
   ...   />
   ... 
   ... """ % (contentsTemplate, searchTemplate), context=context)
+  >>> setSite(site)
 
 
 And load the formui configuration, which will make sure that all macros get 


Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope Tests: 41 OK, 13 Failed

2010-12-19 Thread Marius Gedminas
On Sun, Dec 19, 2010 at 06:45:11PM +0200, Marius Gedminas wrote:
> > Subject: FAILED : winbot / z3c.contents_py_265_32
> > From: buildbot at winbot.zope.org
> > Date: Sat Dec 18 23:06:16 EST 2010
> > URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027073.html
> 
> Interesting.
> 
> c:\buildslave\z3c.contents\build\src\z3c\contents\README.txt, while testing
> copy & paste near line 613, ends up deep in zope.copy.clone() which barfs
> with
> 
> TypeError: non-picklable object

tl;dr: zope.copy is badly broken.

The test here creates a simple Content object:

class Content(object):
"""Sample content which is pickable for copy test."""

zope.interface.implements(IContent)

def __init__(self, title, number):
self.title = title
self.number = number

def __repr__(self):
return u'<%s %s %s>' % (self.__class__.__name__, self.title,
self.number)

It is not persistent, so it gets wrapped in a ContainedProxy.

And then z3c.contents does

copier = IObjectCopier(obj)
copier.copyTo(self.context)

and zope.copypastemove.ObjectCopier.copyTo() does

new = copy(obj)

and zope.copy.copy() does

res = clone(obj)
res.__parent__ = None # wrapped in an if and a try/except.

in that order, and zope.copy.clone() does

tmp = tempfile.TemporaryFile()
persistent = CopyPersistent(obj)
pickler = cPickle.Pickler(tmp, 2)
pickler.persistent_id = persistent.id
pickler.dump(obj)

which tries to pickle an unpickleable ViewPageTemplateFile.  Why?
Because of it's reachable through this chain of references:
http://mg.pov.lt/contained-proxy-pickles-too-much.png

Yes, copying any object with zope.copypastemove makes a copy of your
entire ZODB contents, and then discards it a bit later, by dropping the
__parent__ *after* copying it.

(I have a feeling of deja-vu here, but Google doesn't support me.)

I suppose setting __parent__ to None *before* copying is out of the
question.  How about making pickler.persistent_id check the object against
a blacklist -- containing the __parent__ we don't want to copy -- before
passing it on to persistent.id?

I'll go file a bug at https://bugs.launchpad.net/zope.copy

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope Tests: 41 OK, 13 Failed

2010-12-19 Thread Marius Gedminas
On Sun, Dec 19, 2010 at 12:58:14PM +0100, Zope Tests Summarizer wrote:
> Subject: FAILED : winbot / ztk_10 py_244_win32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 16:04:08 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027038.html

Same old zope.testing.testrunner thing with the missing layer.

> Subject: FAILED : Total languishing bugs for zopeapp: 2
> From: ct at gocept.com
> Date: Sat Dec 18 20:30:17 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027053.html

https://bugs.launchpad.net/zope.app.testing/+bug/638780 and
https://bugs.launchpad.net/zope.app.publication/+bug/646019

One has an attached patch, the other has an inconclusive discussion.

> Subject: FAILED : Total languishing bugs for zopetoolkit: 195
> From: ct at gocept.com
> Date: Sat Dec 18 20:37:12 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027054.html

Lots of "Turn package documentation into Sphinx style".



> Subject: FAILED : winbot / z3c.xmlhttp_py_265_32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 22:14:59 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027069.html

'bin\test.exe' is not recognized as an internal or external command,
operable program or batch file.

This package simply has no tests.  Not a single one.  The only
occurrence of 'test' in the source tree is in a ZCML file, which says:


I vote for at least adding an empty test suite.  Where there's
scaffolding, it becomes easier for someone to come in and add a test.

> Subject: FAILED : winbot / zope.broken_py_265_32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 22:58:13 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027070.html

buildout step failed with

 Error: Missing option: buildout:parts

because buildout.cfg is two lines of code:

  [buildout]
  develop = .

> Subject: FAILED : winbot / z3c.ptcompat_py_265_32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 22:59:07 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027071.html

Expected:

Got:


Easy to fix.  Fixed.

> Subject: FAILED : winbot / z3c.contents_py_265_32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 23:06:16 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027073.html

Interesting.

c:\buildslave\z3c.contents\build\src\z3c\contents\README.txt, while testing
copy & paste near line 613, ends up deep in zope.copy.clone() which barfs
with

TypeError: non-picklable object

> Subject: FAILED : winbot / z3c.zrtresource_py_265_32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 23:12:56 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027074.html

The only differences I see between expected and actual output are in
whitespace.

> Subject: FAILED : winbot / z3c.rml_py_265_32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 23:36:40 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027075.html

"IOError: [Errno 32]" and "Broken pipe" while writing to a file-like object
called 'gs' inside a method called Ghostscript in a file named
EpsImagePlugin.py.

I bet it's trying to convert an image from encapsulated postscript to a bitmap
by spawning ghostscript in a subprocess and feeding it image data.

Is ghostscript installed on the buildbot machine?

And then there are tests that choke on file:/// urls that somehow become
file:\\\ urls.

> Subject: FAILED : winbot / z3c.jsonrpcproxy_py_265_32
> From: buildbot at winbot.zope.org
> Date: Sat Dec 18 23:40:48 EST 2010
> URL: http://mail.zope.org/pipermail/zope-tests/2010-December/027076.html

'bin\test.exe' is not recognized as an internal or external command,
operable program or batch file.

This package has no tests whatsoever.

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )