[Zope-dev] New release for zope.schema
Marius Gedminas
marius at gedmin.as
Thu Mar 22 17:39:31 UTC 2012
On Thu, Mar 22, 2012 at 03:27:20PM +0100, Jan-Carel Brand wrote:
> On Thu, 2012-03-22 at 12:19 +0100, Jan-Carel Brand wrote:
> > Thanks for the review.
> >
> > I've committed my changes and ran the tests with Python 2.6 and 2.7.
> > I don't have Python 3.x handy but will compile the latest and test with
> > that as well.
>
> Ok, I tested zope.schema in python 3.2.2 and there were some errors in
> test_vocabulary.py that I fixed.
I'm in awe of your dedication. I myself don't even know how to run the
zope.schema testsuite under Python 3:
$ python3.2 bootstrap.py
File "bootstrap.py", line 63
exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
^
SyntaxError: invalid syntax
Well, ok, I may be exaggerating a bit.
$ virtualenv -p python3.2 py32
$ py32/bin/python setup.py develop
... this takes a long time... I miss my buildout egg cache ...
$ py32/bin/pip install zope.testrunner
$ py32/bin/pip install zope.testing # have to install test extras by hand?
$ py32/bin/zope-testrunner --test-path=src
...
Ran 255 tests with 1 failures and 0 errors in 0.206 seconds.
> There is however still one more error when testing with Python 3.2.2,
> but this is related to the IContextSourceBinder validation changes made
> by rogerineichen.
>
> First the error:
>
> > FAIL: test_validate_source
> > (zope.schema.tests.test_choice.ContextSourceBinder_ChoiceFieldTests)
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> > File
> > "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/tests/test_choice.py", line 133, in test_validate_source
> > choice = Choice(source=s)
> > File
> > "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/_field.py",
> > line 281, in __init__
> > IContextSourceBinder.providedBy(vocabulary))
> > AssertionError
> >
> The vocabulary is of type SampleContextSourceBinder from test_choice.py,
> which does implement IContextSourceBinder.
>
> > class SampleContextSourceBinder(object):
> > implements(IContextSourceBinder)
> > def __call__(self, context):
> > return SampleVocabulary()
> >
> Looking at it in pdb:
>
> > (Pdb) p vocabulary
> > <zope.schema.tests.test_choice.SampleContextSourceBinder object at
> > 0x3236310>
> > (Pdb) pp vocabulary.__provides__.__iro__
> > (<InterfaceClass zope.interface.Interface>,)
> >
> Just to double-check, I looked at this vocabulary in Python 2.7:
>
> > (Pdb) vocabulary.__provides__.__iro__
> > (<InterfaceClass zope.schema.interfaces.IContextSourceBinder>,
> > <InterfaceClass zope.interface.Interface>)
> >
> There it *does* provide IContextSourceBinder.
>
> Any ideas why this vocabulary doesn't provide it in Python 3?
This smells like a bug in zope.interface, and not in zope.schema:
$ py32/bin/python
Python 3.2.2 (default, Sep 5 2011, 22:09:30)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from zope.interface import Interface, implements
>>> class IFoo(Interface): pass
...
>>> class Foo(object): implements(IFoo)
...
>>> IFoo.implementedBy(Foo)
False
>>> IFoo.providedBy(Foo())
False
In other words I don't think it should block the release of zope.schema.
Marius Gedminas
--
http://pov.lt/ -- Zope 3/BlueBream consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://mail.zope.org/pipermail/zope-dev/attachments/20120322/43cd9738/attachment.sig>
More information about the Zope-Dev
mailing list