[Grok-dev] z3c.testsetup released
Peter Bengtsson
peter at fry-it.com
Thu Feb 21 09:22:37 EST 2008
When I installed z3c.testsetup it broke my Zope 2.9.8, 2.8.5 (and all
other ones I haven't tested yet).
I first installed z3c.testsetup like this:
$ sudo easy_install-2.4 z3c.testsetup
And then later realised that I can do it with setup.py in a project with
buildout.
Here's the traceback now in Zope 2.9.8::
peterbe at trillian:~/zope/zope298 $ ./bin/zopectl fg
Traceback (most recent call last):
File
"/home/peterbe/zope/zope298/lib/python/Zope2/Startup/zopectl.py", line
329, in ?
main()
File
"/home/peterbe/zope/zope298/lib/python/Zope2/Startup/zopectl.py", line
287, in main
options.realize(args)
File
"/home/peterbe/zope/zope298/lib/python/Zope2/Startup/zopectl.py", line
95, in realize
ZDOptions.realize(self, *args, **kw)
File
"/usr/lib/python2.4/site-packages/zdaemon-2.0.1-py2.4.egg/zdaemon/zdoptions.py",
line 279, in realize
self.load_schema()
File
"/usr/lib/python2.4/site-packages/zdaemon-2.0.1-py2.4.egg/zdaemon/zdoptions.py",
line 327, in load_schema
self.schema = ZConfig.loadSchema(self.schemafile)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/loader.py",
line 32, in loadSchema
return SchemaLoader().loadURL(url)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/loader.py",
line 66, in loadURL
return self.loadResource(r)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/loader.py",
line 187, in loadResource
schema = ZConfig.schema.parseResource(resource, self)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/schema.py",
line 27, in parseResource
xml.sax.parse(resource.file, parser)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/__init__.py",
line 31, in parse
parser.parse(filename_or_stream)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 109, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py",
line 123, in parse
self.feed(buffer)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 216, in feed
self._parser.Parse(data, isFinal)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 312, in start_element
self._cont_handler.startElement(name, AttributesImpl(attrs))
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/schema.py",
line 99, in startElement
getattr(self, "start_" + name)(attrs)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/schema.py",
line 475, in start_schema
keytype, valuetype, datatype = self.get_sect_typeinfo(attrs)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/schema.py",
line 201, in get_sect_typeinfo
datatype = self.get_datatype(attrs, "datatype", "null", base)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/schema.py",
line 194, in get_datatype
return self._registry.get(dtname)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/datatypes.py",
line 398, in get
t = self.search(name)
File
"/usr/lib/python2.4/site-packages/ZConfig-2.5.1-py2.4.egg/ZConfig/datatypes.py",
line 423, in search
package = __import__(n, g, g, component)
File
"/home/peterbe/zope/zope298/lib/python/Zope2/Startup/datatypes.py", line
20, in ?
from ZODB.config import ZODBDatabase
File
"/usr/lib/python2.4/site-packages/ZODB3-3.8.0-py2.4-linux-i686.egg/ZODB/__init__.py",
line 31, in ?
from DB import DB
File
"/usr/lib/python2.4/site-packages/ZODB3-3.8.0-py2.4-linux-i686.egg/ZODB/DB.py",
line 27, in ?
from ZODB.Connection import Connection
File
"/usr/lib/python2.4/site-packages/ZODB3-3.8.0-py2.4-linux-i686.egg/ZODB/Connection.py",
line 33, in ?
from ZODB.blob import Blob, rename_or_copy_blob
File
"/usr/lib/python2.4/site-packages/ZODB3-3.8.0-py2.4-linux-i686.egg/ZODB/blob.py",
line 38, in ?
from zope.proxy import getProxiedObject, non_overridable
ImportError: cannot import name non_overridable
Any idea?
Uli Fouquet wrote:
> Hi there,
>
> I finally managed to release the z3c.testsetup package. It's available
> from cheeseshop and the svn.zope.org repository.
>
> The current version is ALPHA-ware, which is worse than 'beware'. Do not
> trust it, do not rely on it! Don't expect the API to stay! Brave souls,
> that check it out although, might consider to share their experiences
> with me, so that I can improve the stuff and fix any shortcomings.
>
> Currently, no valuable ZCML-config comes with the defaults, so you have
> to define your own (or take another one that suits your needs) if you
> need for instance special principals during your functional doctests.
>
> This release might build the base for the upcoming grok testing support.
> The grok version will come with a more verbose ftesting.zcml, which
> should serve at least some normal grokprojects out-of-the-box.
>
> Some documentation can be found on the cheeseshop:
>
> http://pypi.python.org/pypi/z3c.testsetup
>
> The .txt files are at
>
> http://svn.zope.org/z3c.testsetup/trunk/src/z3c/testsetup
>
> might be helpful as well.
>
> Some notes for the impatient:
>
> Setting up a project with z3c.testsetup:
> ========================================
>
> This is done in two steps:
>
> 1) Write a setup file
> ---------------------
>
> Given, your project is organized like a usual grokproject or otherwise
> buildoutified, add 'z3c.testsetup' to the required packages in your
> setup.py. Run buildout to fetch the package.
>
> Then, edit a file in your src/<projectname> directory, that will be
> found by the testrunner. Normally this includes filenames like
> 'tests.py' or 'ftests.py'.
>
> In this file, write something like::
>
> import z3c.testsetup
> test_suite = z3c.testsetup.register_all_tests('<mypackagename>')
>
> That's it for the setup. This is the whole file.
>
> If you have a special 'ftesting.zcml' you want to have registered, use::
>
> import z3c.testsetup
> test_suite = z3c.testsetup.register_all_tests(
> '<mypackagename>',
> zcml_config = '<path_to_zcml_file>',
> layer_name = 'MyFunctionalLayer')
>
> Grokprojects already provide a testing module, that defines a complete
> ZCML-Layer with principals etc. It can be activated like this with
> z3c.testsetup::
>
> import z3c.testsetup
> from <myprojname>.testing import FunctionalLayer
> test_suite = z3c.testsetup.register_all_tests(
> '<myprojname>', layer = FunctionalLayer)
>
> 2) Mark your test files/modules
> -------------------------------
>
> Modify the modules and doctest files you want to include as follows:
>
> - doctestfiles must have .txt or .rst filename extension and must
> provide a marker in the text that reads like this::
>
> :Test-Layer: functional
>
> for functional doctests, or::
>
> :Test-Layer: unit
>
> for unit doctests.
>
> - 'normal' Python modules (now supported) must provide a module
> docstring, that reads::
>
> :Test-Layer: python
>
> Normal Python modules are considered those, that define TestCases
> (contrary to examples, as doctests do). If you do doctests inside
> Python modules (for example in docstrings of classes and functions
> therein), add one of the *doctest* markers
> in the module docstring and call::
>
> test_suite = z3c.testsetup.register_all_tests(
> '<mypackagename>',
> extensions=['.txt', '.rst', '.py'])
>
> in your setup file.
>
> If you now run a testrunner (bin/test for example), the marked testfiles
> should be found and the tests be executed.
>
> There is a lot of documentation in the package itself, which can tell
> you how to modify standard test setups.
>
> Kind regards,
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
More information about the Grok-dev
mailing list