[Zope3-Users] Re: Moving from z3 tarball to z3 buildout/eggs
Derek Richardson wrote: One problem confronts me, though, before I do the boring work of sorting out the dependencies. My package is designed to run in both z2 and z3. So, I could add a bunch of z3-specific dependencies to a z3-configure.zcml that is loaded only if Five is not installed. Not too hard. But, the hard part is: I don't want to add all the z3 eggs to my setup.py, Yes you do. because that's ugly if I'm actually running in z2. No, Zope 2 is ugly because it doesn't support eggs yet :). Well, actually I *did* change that. I've eggified Zope 2.11 (the trunk) a while ago and it seems to work so far. My idea is to have a z3-only package that depends on my z3/z2 hybrid package and that simply has a setup.py that includes all the z3 dependencies and a configure.zcml and an ftesting.zcml that does all the z3-specific zcml work. And then I can have a z3-specific buildout that uses the z3-specific package and another buildout for z2 that uses the base package and a third buildout for z2+plone, which includes some additional plone-specific packages. A big pain, but I want my code usuable in all three environments, to the extent that is possible. Opinions? If you're going to be basing this on Zope 2.11/3.4, I'd say you're better off with a simpler solution: betting on eggs all the way. I certainly hope that Zope 2.11 will go this way (I will do everything I can to support that) and I see similar wishes in the Plone community as well. Fortunately, eggification is just a means of packaging and pretty orthogonal to the actual code. -- http://worldcookery.com -- Professional Zope documentation and training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Moving from z3 tarball to z3 buildout/eggs
Philipp von Weitershausen wrote: * If vice depends on the configuration of another package, but always assumed that this package's configuration was being loaded by Zope 3.3's site.zcml, make this dependency *explicit* now in vice's configure.zcml. For example, let's say that vice needs the intid utility and event subscriber registrations to be active, then it should do: at the top of vice/configure.zcml. This will probably add more explicit depenencies to vice than you currently have (they should also go into setup.py). Note that you won't have to worry about ZCML being loaded several times. It won't be, zope.configuration makes sure of that. OK, agreed, this is the *right* way. And thank you for the detailed instructions on how to achieve this - they are very clear and I plan to follow them closely. One problem confronts me, though, before I do the boring work of sorting out the dependencies. My package is designed to run in both z2 and z3. So, I could add a bunch of z3-specific dependencies to a z3-configure.zcml that is loaded only if Five is not installed. Not too hard. But, the hard part is: I don't want to add all the z3 eggs to my setup.py, because that's ugly if I'm actually running in z2. My idea is to have a z3-only package that depends on my z3/z2 hybrid package and that simply has a setup.py that includes all the z3 dependencies and a configure.zcml and an ftesting.zcml that does all the z3-specific zcml work. And then I can have a z3-specific buildout that uses the z3-specific package and another buildout for z2 that uses the base package and a third buildout for z2+plone, which includes some additional plone-specific packages. A big pain, but I want my code usuable in all three environments, to the extent that is possible. Opinions? Thanks, Derek ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Moving from z3 tarball to z3 buildout/eggs
Derek Richardson wrote: The problem is that I don't know how much of zope.app these tests depend on. Very few eggs are actually required by imports in Vice. But the library is not much use (and there's not much to test) without a pretty thorough install, I suspect. Should I be attempting to grab all the zope eggs and making a replica of the full install? No. Or should I be trying to judiciously minimize the eggs that I use for testing? Yes. And what is the best way to go about whichever of these paths I should follow? I suppose you can do this inductively (start ftesting.zcml from scratch) or deductively (start out with a full-fledged ftesting.zcml and remove things). If you want to do things inductively, there are a few hints I can give you: * If vice depends on the configuration of another package, but always assumed that this package's configuration was being loaded by Zope 3.3's site.zcml, make this dependency *explicit* now in vice's configure.zcml. For example, let's say that vice needs the intid utility and event subscriber registrations to be active, then it should do: at the top of vice/configure.zcml. This will probably add more explicit depenencies to vice than you currently have (they should also go into setup.py). Note that you won't have to worry about ZCML being loaded several times. It won't be, zope.configuration makes sure of that. * ftesting.zcml should somewhere, therefore load all of its direct dependencies anyway. Then you should check which dependencies your tests have. You mention folders and other things. So you probably want to include zope.app.zcmlfiles/configure.zcml (which is the old 'zope.app/configure.zcml') because that pretty much loads the basic Zope 3 stuff. * Don't forget to load the meta stuff first. This usually boils down to: and the security policy's meta.zcml if you want to define roles: * You'll need to define a security policy. Usually we take zope.app.securitypolicy for that: Then you want to define the standard principals that are needed in ftests (anonmyous, the manager, etc.). Look at Zope 3.3's ftesting.zcml for those (incl. the grants). I *really* like the buildout approach. It would just be even nicer if I knew of some way to have buildout replicate the entire Zope app server ecosystem for testing without having to specify the eggs one ... by ... one. I think it's much better to sit down for a moment and *just* load the things you really need in tests. Usually this leads to much better tests. May I just remind of the horrid PloneTestCase which people have simply started using for every tests, which has cause Plone tests to be poorly isolated, quite slow and depend on much too many things at once. The path to a truly eggified system is to think about dependencies and write good tests that only load a minimum load of dependencies. This is not a trivial task. Testing never is. And I don't think there's a silver bullet, either. -- http://worldcookery.com -- Professional Zope documentation and training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users