-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Philipp von Weitershausen wrote:
Andreas Jung wrote:
I added Products/PageTemplates/configure.zcml to register an utility. That works fine when running Zope however "zopectl test" won't work properly anymore because the utility registration does not seem to happen when running the tests. Bug or feature?
Tests need to do their own setup. ZCML isn't magically loaded for tests, unless those tests are run within a layer that loads all ZCML before running the tests.
So, there are two options: - modify the setUp() of the tests in question to provideUtility(your_utility) - make the respective tests run in a layer that loads the ZCML. I don't think layer support is on the trunk yet. Whit Morriss has a branch where he added that to Zope 2, but it still hasn't been merged :(
I'm pretty sure that layer support is on the 2.10 branch and the trunk: the CMF trunk tests now depend on it:: $ bin/zopectl show zdctl/zdrun options: schemafile: '/home/tseaver/projects/Zope-CVS/Zope-2.10-branch/lib/python/Zope2/Startup/zopeschema.xml' ... $ bin/zopectl test Running tests via: /home/tseaver/projects/Zope-CVS/bin/python2.4 /home/tseaver/projects/Zope-CVS/Zope-2.10-branch/bin/test.py -v - --config-file /home/tseaver/projects/CMF/cmf_test/z210_cmfhead/etc/zope.conf Parsing /home/tseaver/projects/CMF/cmf_test/z210_cmfhead/etc/zope.conf Running tests at level 1 Running unit tests: Running: ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Ran 809 tests with 0 failures and 0 errors in 11.052 seconds. Running Products.CMFCore.testing.FunctionalZCMLLayer tests: Set up Products.CMFCore.testing.FunctionalZCMLLayer in 1.603 seconds. ... Tearing down left over layers: Tear down Products.GenericSetup.testing.ExportImportZCMLLayer in 0.000 seconds. Total: 1351 tests, 0 failures, 0 errors Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFoU2z+gerLs4ltQ4RAmxhAKDUo3oEHv8bUIoW/dLMmpeHvMWvdACgy1wU 0P+mwfqR/0MVCICtu5AZ568= =fuE+ -----END PGP SIGNATURE-----