Hi,
I *think* this is a bug in zc.relationship, but I'm not quite sure.
I'm using ZODB3 3.8.1 (to get BLOB support) and trying to install
plone.app.relations, which depends on zc.relationship 1.0.2. In
particular, it subclasses zc.relationship.shared.Container, and stores
a zc.relationship.index.Index object in self.relationIndex.
Now, the __init__ of zc.relationship.index.Index, which derives from
Persistent, contains the code below. In self._relTools and and
self._attrs, there are a pile of modules, types and functions being
stored. I think these are causing the ZODB to barf. Interestingly, with
whatever version of ZODB that comes with Zope 2.10 (3.7?), there's no
problem.
Any ideas how to work around this, or even why it's a problem in one
version of the ZODB but not another?
zc.relationship.index.Index's initialiser:
def __init__(self, attrs, defaultTransitiveQueriesFactory=None,
dumpRel=generateToken, loadRel=resolveToken,
relFamily=IFBTree, deactivateSets=False):
self._name_TO_mapping = OOBTree.OOBTree()
# held mappings are objtoken to (relcount, relset)
self._EMPTY_name_TO_relcount_relset = OOBTree.OOBTree()
self._reltoken_name_TO_objtokenset = OOBTree.OOBTree()
self.defaultTransitiveQueriesFactory =
defaultTransitiveQueriesFactory
self._relTools = getModuleTools(relFamily)
self._relTools['load'] = loadRel
self._relTools['dump'] = dumpRel
self._relLength = Length.Length()
self._relTokens = self._relTools['TreeSet']()
self.deactivateSets = deactivateSets
self._attrs = _attrs = {} # this is private, and it's not
expected to
# mutate after this initial setting.
seen = set()
for data in attrs:
# see README.txt for description of attrs.
if zope.interface.interfaces.IElement.providedBy(data):
data = {'element': data}
res = getModuleTools(data.get('btree', IFBTree))
res['element'] = val = data['element']
res['attrname'] = val.__name__
res['name'] = data.get('name', res['attrname'])
if res['name'] in _attrs or val in seen:
raise ValueError('Duplicate in attrs', name, val)
seen.add(val)
_attrs[res['name']] = res
res['dump'] = data.get('dump', generateToken)
res['load'] = data.get('load', resolveToken)
if (res['dump'] is None) ^ (res['load'] is None):
raise ValueError(
"either both of 'dump' and 'load' must be None, or
neither")
# when both load and dump are None, this is a small
# optimization that can be a large optimization if the
returned
# value is one of the main four options of the selected
btree
# family (BTree, TreeSet, Set, Bucket).
res['interface'] = val.interface
res['multiple'] = data.get('multiple', False)
res['call'] = zope.interface.interfaces.IMethod.providedBy(val)
if res['TreeSet'].__name__.startswith('I'):
Mapping = IOBTree.IOBTree
else:
assert res['TreeSet'].__name__.startswith('O')
Mapping = OOBTree.OOBTree
self._name_TO_mapping[res['name']] = Mapping()
# these are objtoken to (relcount, relset)
Regards,
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
Hi,
I'm trying to turn the results of a test run using zope.testing
(zc.recipe.testrunner) into a JUnit compliant XML format so that I can
graph it with Hudson (a continuous integration tool).
Are there any hooks in zope.testing to write reporting to a file?
The output I want is something like this:
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="1" failures="3" hostname="hazelnut.osuosl.org"
name="net.cars.engine.PistonTest" tests="5" time="0.048"
timestamp="2007-11-02T23:13:50">
<properties>
...
</properties>
<testcase classname="net.cars.engine.PistonTest" name="moveUp"
time="0.022">
<error message="test timed out after 1 milliseconds"
type="java.lang.Exception">java.lang.Exception: test timed out after 1
milliseconds
</error>
</testcase>
<testcase classname="net.cars.engine.PistonTest" name="moveDown"
time="0.0010" />
<testcase classname="net.cars.engine.PistonTest" name="checkStatus"
time="0.0030">
<failure message="Plunger status invalid to proceed driving."
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
Plunger status invalid to proceed driving.
at net.cars.engine.PistonTest.checkStatus(PistonTest.java:42)
</failure>
</testcase>
<testcase classname="net.cars.engine.PistonTest" name="checkSpeed"
time="0.0080">
<failure message="Plunger upward speed below specifications."
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
Plunger upward speed below specifications.
at net.cars.engine.PistonTest.checkSpeed(PistonTest.java:47)
</failure>
</testcase>
<testcase classname="net.cars.engine.PistonTest" name="lubricate"
time="0.0030">
<failure message="Failed to lubricate the plunger."
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
Failed to lubricate the plunger.
at net.cars.engine.PistonTest.lubricate(PistonTest.java:52)
</failure>
</testcase>
<system-out><![CDATA[Slowly moving up]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>
Obviously, this is a Java test case, but you get the idea. Incidentally,
I think nose supports this kind of thing already, but I don't think I
can run zope-like tests using layers etc via nose?
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
Hi,
Something has changed in Zope 2.12 that is causing tests that use
PlacelessSetup's tearDown() with Five to fail:
Error in test
/Users/optilude/Development/Plone/Code/Build/plone/4.0/src/plone.autoform/plone/autoform/tests/../autoform.txt
Traceback (most recent call last):
File
"/Users/optilude/.buildout/eggs/zope.testing-3.7.7-py2.6.egg/zope/testing/doctest.py",
line 2416, in debug
self.tearDown()
File
"/Users/optilude/.buildout/eggs/zope.testing-3.7.7-py2.6.egg/zope/testing/doctest.py",
line 2295, in tearDown
self._dt_tearDown(test)
File
"/Users/optilude/.buildout/eggs/zope.app.testing-3.6.2-py2.6.egg/zope/app/testing/placelesssetup.py",
line 59, in tearDown
tearDown_()
File
"/Users/optilude/.buildout/eggs/zope.testing-3.7.7-py2.6.egg/zope/testing/cleanup.py",
line 55, in cleanUp
cleanUp()
File
"/Users/optilude/.buildout/eggs/zope.testing-3.7.7-py2.6.egg/zope/testing/cleanup.py",
line 63, in cleanUp
func(*args, **kw)
File
"/Users/optilude/.buildout/eggs/Zope2-2.12.1-py2.6-macosx-10.6-i386.egg/Products/Five/fiveconfigure.py",
line 228, in cleanUp
Products.meta_types = tuple([ info for info in Products.meta_types
AttributeError: 'module' object has no attribute 'meta_types'
Sure enough, Products.meta_types is not set. In the Zope2 egg,
Products/__init__.py contains only the setuptools boilerplate for
namespace packages. I'm not sure how or where Products.meta_type is set
these days.
Does anyone know how to correctly fix this? We could make the tear-down
code in Five more robust, obviously, but I fear that's just hiding a
deeper problem?
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
Hi,
Since zc.recipe.egg 1.2.0, there's an option to generate scripts which
contains relative paths to eggs installed in the eggs/ directory [1]
This is very handy if you want to move your buildout around, without
needing to relaunch the whole buildout process.
What do maintainers of z3c.recipe.paster think if I propose a patch
which add this option (or something else) to support the same thing
for this recipe?
Actually, this can be a relatively minor change, since the recipe
already use zc.recipe.egg, which means it only has to pass the
corresponding option to this one.
Thoughts?
Cheers,
Jonathan
[1] : http://pypi.python.org/pypi/zc.recipe.egg#relative-egg-paths