[Checkins] SVN: z3c.relationfield/trunk/ * Updated test setup and test to run with current versions of dependent

Michael Howitz mh at gocept.com
Thu Sep 30 02:37:17 EDT 2010


Log message for revision 117080:
  * Updated test setup and test to run with current versions of dependent
    packages, thus running with Python 2.6, too.
  
  * Added missing (test) dependencies.
  

Changed:
  U   z3c.relationfield/trunk/CHANGES.txt
  A   z3c.relationfield/trunk/bootstrap.py
  U   z3c.relationfield/trunk/buildout.cfg
  U   z3c.relationfield/trunk/setup.py
  U   z3c.relationfield/trunk/src/z3c/relationfield/README.txt

-=-
Modified: z3c.relationfield/trunk/CHANGES.txt
===================================================================
--- z3c.relationfield/trunk/CHANGES.txt	2010-09-30 06:31:25 UTC (rev 117079)
+++ z3c.relationfield/trunk/CHANGES.txt	2010-09-30 06:37:17 UTC (rev 117080)
@@ -1,11 +1,20 @@
 CHANGES
 *******
 
-0.5.1 (2009-10-11)
+0.7 (unreleased)
 ================
 
-- Fixes broken release
+* Updated test setup and test to run with current versions of dependent
+  packages, thus running with Python 2.6, too.
 
+* Added missing (test) dependencies.
+
+
+0.6.1 (2009-10-11)
+==================
+
+* Fixes broken release.
+
 0.6 (2009-10-11)
 ================
 
@@ -53,7 +62,7 @@
   ``z3c.relationfieldui``) this can be used to create drop-down
   selections for relations.
 
-* Clarify the way comparing and sorting of ``RelationValue`` objects is 
+* Clarify the way comparing and sorting of ``RelationValue`` objects is
   done in order to better support choice support.
 
 0.3.2 (2009-01-21)
@@ -67,14 +76,14 @@
 * Introduce sensible sort order for relations, based on a
   ``(from_attribute, from_path, to_path)`` tuple.
 
-* Relations will now never compare to ``None``. 
+* Relations will now never compare to ``None``.
 
 0.3 (2009-01-19)
 ================
 
 * Introduce two new interfaces: ``IHasOutgoingRelations`` and
   ``IHasIncomingRelations``. ``IHasOutgoingRelations`` should be provided
-  by objects that actually have relations set on them, so that 
+  by objects that actually have relations set on them, so that
   they can be properly cataloged. ``IHasIncomingRelations`` should be
   set on objects that can be related to, so that broken relations
   can be properly tracked. ``IHasRelations`` now extends both,

Copied: z3c.relationfield/trunk/bootstrap.py (from rev 115622, zc.buildout/trunk/bootstrap/bootstrap.py)
===================================================================
--- z3c.relationfield/trunk/bootstrap.py	                        (rev 0)
+++ z3c.relationfield/trunk/bootstrap.py	2010-09-30 06:37:17 UTC (rev 117080)
@@ -0,0 +1,116 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+"""
+
+import os, shutil, sys, tempfile, urllib2
+from optparse import OptionParser
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+# parsing arguments
+parser = OptionParser()
+parser.add_option("-v", "--version", dest="version",
+                          help="use a specific zc.buildout version")
+parser.add_option("-d", "--distribute",
+                   action="store_true", dest="distribute", default=False,
+                   help="Use Distribute rather than Setuptools.")
+
+parser.add_option("-c", None, action="store", dest="config_file",
+                   help=("Specify the path to the buildout configuration "
+                         "file to be used."))
+
+options, args = parser.parse_args()
+
+# if -c was provided, we push it back into args for buildout' main function
+if options.config_file is not None:
+    args += ['-c', options.config_file]
+
+if options.version is not None:
+    VERSION = '==%s' % options.version
+else:
+    VERSION = ''
+
+USE_DISTRIBUTE = options.distribute
+args = args + ['bootstrap']
+
+try:
+    import pkg_resources
+    import setuptools
+    if not hasattr(pkg_resources, '_distribute'):
+        raise ImportError
+except ImportError:
+    ez = {}
+    if USE_DISTRIBUTE:
+        exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
+                         ).read() in ez
+        ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True)
+    else:
+        exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                             ).read() in ez
+        ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+    reload(sys.modules['pkg_resources'])
+    import pkg_resources
+
+if sys.platform == 'win32':
+    def quote(c):
+        if ' ' in c:
+            return '"%s"' % c # work around spawn lamosity on windows
+        else:
+            return c
+else:
+    def quote (c):
+        return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws  = pkg_resources.working_set
+
+if USE_DISTRIBUTE:
+    requirement = 'distribute'
+else:
+    requirement = 'setuptools'
+
+if is_jython:
+    import subprocess
+
+    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+           quote(tmpeggs), 'zc.buildout' + VERSION],
+           env=dict(os.environ,
+               PYTHONPATH=
+               ws.find(pkg_resources.Requirement.parse(requirement)).location
+               ),
+           ).wait() == 0
+
+else:
+    assert os.spawnle(
+        os.P_WAIT, sys.executable, quote (sys.executable),
+        '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION,
+        dict(os.environ,
+            PYTHONPATH=
+            ws.find(pkg_resources.Requirement.parse(requirement)).location
+            ),
+        ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout' + VERSION)
+import zc.buildout.buildout
+zc.buildout.buildout.main(args)
+shutil.rmtree(tmpeggs)

Modified: z3c.relationfield/trunk/buildout.cfg
===================================================================
--- z3c.relationfield/trunk/buildout.cfg	2010-09-30 06:31:25 UTC (rev 117079)
+++ z3c.relationfield/trunk/buildout.cfg	2010-09-30 06:37:17 UTC (rev 117080)
@@ -1,13 +1,15 @@
 [buildout]
 develop = .
 parts = test
-extends = http://grok.zope.org/releaseinfo/grok-0.14.cfg
+extends = http://grok.zope.org/releaseinfo/grok-1.1.1.cfg
+allow-picked-versions = false
 versions = versions
 
 [versions]
-lxml = 2.2.1
-zope.testing = 3.6.0
-zc.sourcefactory = 0.3.5
+lxml = 2.2.6
+z3c.schema2xml = 1.0
+zc.relation = 1.0
+z3c.objpath = 1.0
 
 [test]
 recipe = zc.recipe.testrunner

Modified: z3c.relationfield/trunk/setup.py
===================================================================
--- z3c.relationfield/trunk/setup.py	2010-09-30 06:31:25 UTC (rev 117079)
+++ z3c.relationfield/trunk/setup.py	2010-09-30 06:37:17 UTC (rev 117080)
@@ -38,6 +38,8 @@
         'zc.relation >= 1.0',
         # for tests
         'zope.app.zcmlfiles',
+        'zope.app.testing',
+        'zope.app.keyreference',
         'zope.securitypolicy',
         ],
     extras_require = {

Modified: z3c.relationfield/trunk/src/z3c/relationfield/README.txt
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/README.txt	2010-09-30 06:31:25 UTC (rev 117079)
+++ z3c.relationfield/trunk/src/z3c/relationfield/README.txt	2010-09-30 06:37:17 UTC (rev 117080)
@@ -70,7 +70,7 @@
 
   >>> from zope.app.intid import IntIds
   >>> from zope.app.intid.interfaces import IIntIds
-  >>> root['intids'] = intids = IntIds() 
+  >>> root['intids'] = intids = IntIds()
   >>> sm = root.getSiteManager()
   >>> sm.registerUtility(intids, provided=IIntIds)
 
@@ -134,7 +134,7 @@
   >>> from_object = root['b'].rel.from_object
   >>> from_object.__name__
   u'b'
- 
+
 This object is also known as the ``__parent__``; again the event
 sytem took care of setting this::
 
@@ -145,37 +145,39 @@
 The relation also knows about the interfaces of both the pointing object
 and the object that is being pointed at::
 
-  >>> sorted(root['b'].rel.from_interfaces)
-  [<InterfaceClass zope.app.container.interfaces.IContained>,
-   <InterfaceClass z3c.relationfield.interfaces.IHasRelations>, 
-   <InterfaceClass __builtin__.IItem>, 
+  >>> from pprint import pprint
+  >>> pprint(sorted(root['b'].rel.from_interfaces))
+  [<InterfaceClass zope.location.interfaces.IContained>,
+   <InterfaceClass z3c.relationfield.interfaces.IHasRelations>,
+   <InterfaceClass __builtin__.IItem>,
    <InterfaceClass persistent.interfaces.IPersistent>]
 
-  >>> sorted(root['b'].rel.to_interfaces)
-  [<InterfaceClass zope.app.container.interfaces.IContained>, 
+  >>> pprint(sorted(root['b'].rel.to_interfaces))
+  [<InterfaceClass zope.location.interfaces.IContained>,
    <InterfaceClass z3c.relationfield.interfaces.IHasRelations>,
-   <InterfaceClass __builtin__.IItem>, 
+   <InterfaceClass __builtin__.IItem>,
    <InterfaceClass persistent.interfaces.IPersistent>]
 
 We can also get the interfaces in flattened form::
 
-  >>> sorted(root['b'].rel.from_interfaces_flattened)
-  [<InterfaceClass zope.app.container.interfaces.IContained>,
+  >>> pprint(sorted(root['b'].rel.from_interfaces_flattened))
+  [<InterfaceClass zope.location.interfaces.IContained>,
    <InterfaceClass z3c.relationfield.interfaces.IHasIncomingRelations>,
    <InterfaceClass z3c.relationfield.interfaces.IHasOutgoingRelations>,
-   <InterfaceClass z3c.relationfield.interfaces.IHasRelations>,   
-   <InterfaceClass __builtin__.IItem>, 
-   <InterfaceClass zope.location.interfaces.ILocation>, 
-   <InterfaceClass persistent.interfaces.IPersistent>, 
+   <InterfaceClass z3c.relationfield.interfaces.IHasRelations>,
+   <InterfaceClass __builtin__.IItem>,
+   <InterfaceClass zope.location.interfaces.ILocation>,
+   <InterfaceClass persistent.interfaces.IPersistent>,
    <InterfaceClass zope.interface.Interface>]
-  >>> sorted(root['b'].rel.to_interfaces_flattened)
-  [<InterfaceClass zope.app.container.interfaces.IContained>,
+
+  >>> pprint(sorted(root['b'].rel.to_interfaces_flattened))
+  [<InterfaceClass zope.location.interfaces.IContained>,
    <InterfaceClass z3c.relationfield.interfaces.IHasIncomingRelations>,
    <InterfaceClass z3c.relationfield.interfaces.IHasOutgoingRelations>,
    <InterfaceClass z3c.relationfield.interfaces.IHasRelations>,
-   <InterfaceClass __builtin__.IItem>, 
-   <InterfaceClass zope.location.interfaces.ILocation>, 
-   <InterfaceClass persistent.interfaces.IPersistent>, 
+   <InterfaceClass __builtin__.IItem>,
+   <InterfaceClass zope.location.interfaces.ILocation>,
+   <InterfaceClass persistent.interfaces.IPersistent>,
    <InterfaceClass zope.interface.Interface>]
 
 Paths
@@ -280,7 +282,7 @@
 
   >>> sorted(catalog.findRelations({'to_id': intids.getId(root['b'])}))
   []
- 
+
 We can also issue more specific queries, restricting it on the
 attribute used for the relation field and the interfaces provided by
 the related objects. Here we look for all relations between ``b`` and
@@ -324,12 +326,12 @@
 
 Nothing points to ``c`` yet::
 
-  >>> sorted(catalog.findRelations({'to_id': c_id})) 
+  >>> sorted(catalog.findRelations({'to_id': c_id}))
   []
 
 We currently have a relation from ``b`` to ``a``::
 
-  >>> sorted(catalog.findRelations({'to_id': intids.getId(root['a'])})) 
+  >>> sorted(catalog.findRelations({'to_id': intids.getId(root['a'])}))
   [<z3c.relationfield.relation.RelationValue object at ...>]
 
 We can change the relation to point at a new object ``c``::
@@ -345,12 +347,12 @@
 
 We should find now a single relation from ``b`` to ``c``::
 
-  >>> sorted(catalog.findRelations({'to_id': c_id})) 
+  >>> sorted(catalog.findRelations({'to_id': c_id}))
   [<z3c.relationfield.relation.RelationValue object at ...>]
 
 The relation to ``a`` should now be gone::
 
-  >>> sorted(catalog.findRelations({'to_id': intids.getId(root['a'])})) 
+  >>> sorted(catalog.findRelations({'to_id': intids.getId(root['a'])}))
   []
 
 Removing the relation
@@ -358,7 +360,7 @@
 
 We have a relation from ``b`` to ``c`` right now::
 
-  >>> sorted(catalog.findRelations({'to_id': c_id})) 
+  >>> sorted(catalog.findRelations({'to_id': c_id}))
   [<z3c.relationfield.relation.RelationValue object at ...>]
 
 We can clean up an existing relation from ``b`` to ``c`` by setting it
@@ -374,7 +376,7 @@
 Setting the relation on ``b`` to ``None`` should remove that relation
 from the relation catalog, so we shouldn't be able to find it anymore::
 
-  >>> sorted(catalog.findRelations({'to_id': intids.getId(root['c'])})) 
+  >>> sorted(catalog.findRelations({'to_id': intids.getId(root['c'])}))
   []
 
 Let's reestablish the removed relation::
@@ -382,9 +384,9 @@
   >>> root['b'].rel = RelationValue(c_id)
   >>> notify(ObjectModifiedEvent(root['b']))
 
-  >>> sorted(catalog.findRelations({'to_id': c_id})) 
+  >>> sorted(catalog.findRelations({'to_id': c_id}))
   [<z3c.relationfield.relation.RelationValue object at ...>]
-          
+
 Copying an object with relations
 ================================
 
@@ -399,7 +401,7 @@
 Two relations to ``c`` can now be found, one from the original, and
 the other from the copy::
 
-  >>> l = sorted(catalog.findRelations({'to_id': c_id})) 
+  >>> l = sorted(catalog.findRelations({'to_id': c_id}))
   >>> len(l)
   2
   >>> l[0].from_path
@@ -446,16 +448,16 @@
 
 We have a relation from ``b`` to ``c`` right now::
 
-  >>> sorted(catalog.findRelations({'to_id': c_id})) 
+  >>> sorted(catalog.findRelations({'to_id': c_id}))
   [<z3c.relationfield.relation.RelationValue object at ...>]
 
 We have no broken relations::
 
-  >>> sorted(catalog.findRelations({'to_id': None})) 
+  >>> sorted(catalog.findRelations({'to_id': None}))
   []
 
 The relation isn't broken::
-  
+
   >>> b.rel.isBroken()
   False
 
@@ -486,13 +488,13 @@
 We cannot find the broken relation in the catalog this way as it's not
 pointing to ``c_id`` anymore::
 
-  >>> sorted(catalog.findRelations({'to_id': c_id})) 
+  >>> sorted(catalog.findRelations({'to_id': c_id}))
   []
 
 We can however find it by searching for relations that have a
 ``to_id`` of ``None``::
 
-  >>> sorted(catalog.findRelations({'to_id': None})) 
+  >>> sorted(catalog.findRelations({'to_id': None}))
   [<z3c.relationfield.relation.RelationValue object at ...>]
 
 A broken relation isn't equal to ``None`` (this was a bug)::
@@ -626,7 +628,7 @@
   True
 
 Temporary relation values also work with ``RelationList`` objects::
-  
+
   >>> root['multi_temp'] = MultiItem()
   >>> root['multi_temp'].rel = [TemporaryRelationValue('a')]
 
@@ -639,11 +641,11 @@
 
   >>> root['multi_temp'].rel
   [<z3c.relationfield.relation.RelationValue object at ...>]
- 
+
 And we will now see this new relation appear in the catalog::
 
   >>> after3 = sorted(catalog.findRelations({'to_id': a_id}))
-  >>> len(after3) > len(after2) 
+  >>> len(after3) > len(after2)
   True
 
 Broken temporary relations
@@ -660,7 +662,7 @@
   >>> realize_relations(root['e'])
 
 We end up with a broken relation::
-  
+
   >>> root['e'].rel.isBroken()
   True
 



More information about the checkins mailing list