Path problem with zope.testing and buildout
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm not entirely sure this is the right place to report this problem, but I'll give it a shot anyway. I'm sure this is pebkac but I haven't figure it out yet. My current Mailman 3 code is buildout-based. The branch is here: https://code.launchpad.net/~mailman-coders/mailman/3.0 Here's my buildout.cfg file: - -----snip snip----- [buildout] parts = interpreter tags test unzip = true develop = . [interpreter] recipe = zc.recipe.egg interpreter = py eggs = lazr.config lazr.delegates locknix mailman munepy storm zope.interface [tags] recipe = z3c.recipe.tag:tags eggs = mailman [test] recipe = zc.recipe.testrunner eggs = mailman defaults = '--tests-pattern ^tests --exit-with-status'.split() # Hack in extra arguments to zope.testrunner. initialization = from mailman.testing.layers import ConfigLayer; ConfigLayer.hack_options_parser() - -----snip snip----- If I build this out and then run bin/test, my test suite passes, but I get ImportErrors for every dependent egg that gets downloaded. It's as if the eggs directory is being search for tests even though eggs=mailman is in the [test] section. However, if I put the following in my ~/.buildout/default.cfg, I don't those ImportErrors, presumably because the eggs are so far distant that Zope's testrunner doesn't find them. - -----snip snip----- [buildout] eggs-directory=/Users/barry/.buildout/eggs download-cache=/Users/barry/.buildout/download-cache - -----snip snip----- Here's an excerpt from the bin/test output (with extra blank lines suppressed): Test-module import failures: Module: eggs.lazr.config-1.1-py2.6.egg.lazr.config.tests ImportError: No module named eggs.lazr.config-1.1- py2.6.egg.lazr.config.tests Module: eggs.lazr.delegates-1.0-py2.6.egg.lazr.delegates.tests ImportError: No module named eggs.lazr.delegates-1.0- py2.6.egg.lazr.delegates.tests Module: eggs.zc.buildout-1.1.1-py2.6.egg.zc.buildout.tests ImportError: No module named eggs.zc.buildout-1.1.1- py2.6.egg.zc.buildout.tests Module: eggs.zc.buildout-1.1.1-py2.6.egg.zc.buildout.testselectingpython ImportError: No module named eggs.zc.buildout-1.1.1- py2.6.egg.zc.buildout.testselectingpython Module: eggs.zc.recipe.egg-1.1.0-py2.6.egg.zc.recipe.egg.tests ImportError: No module named eggs.zc.recipe.egg-1.1.0- py2.6.egg.zc.recipe.egg.tests Module: eggs.zc.recipe.testrunner-1.1.0- py2.6.egg.zc.recipe.testrunner.tests ImportError: No module named eggs.zc.recipe.testrunner-1.1.0- py2.6.egg.zc.recipe.testrunner.tests Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.common.tests.test_idatetime ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.common.tests.test_idatetime Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.common.tests.test_import_interfaces ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.common.tests.test_import_interfaces Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_adapter ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_adapter Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_advice ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_advice Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_declarations ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_declarations Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_document ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_document Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_element ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_element Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_interface ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_interface Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_odd_declarations ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_odd_declarations Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_sorting ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_sorting Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_verify ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_verify Module: eggs.zope.testing-3.7.1-py2.6.egg.zope.testing.tests ImportError: No module named eggs.zope.testing-3.7.1- py2.6.egg.zope.testing.tests Module: eggs.zope.testing-3.7.1-py2.6.egg.zope.testing.testrunner.tests ImportError: No module named eggs.zope.testing-3.7.1- py2.6.egg.zope.testing.testrunner.tests The same behavior occurs on Linux. Does anybody have any suggestions for making bin/test work without putting your eggs outside the source tree? Or if it's not possible, I'll update my README.txt to explain that you have to have a ~/.buildout/default.cfg. Thanks, Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iQCVAwUBSXacqnEjvBPtnXfVAQIfoQP+NmPMyOlky4rqSF9UWF/cOi4K/G++YYRO DodibIMefqhoX+2SEjfavm9NN9nIVt0Wrvaty0acnZ1FHc7pPwN+szUV6is1QAao Q7WQbZyQewPVk+3tucuBD7UtcMoBpHScq4afL4u4crSozf3DpVI0YwqhYf4hvvo8 XrFTINdDfCI= =E5eP -----END PGP SIGNATURE-----
You might try the approach I used in the following: http://rpatterson.net/blog/running-tests-in-egg-buildouts Ross Barry Warsaw <barry@python.org> writes:
I'm not entirely sure this is the right place to report this problem, but I'll give it a shot anyway. I'm sure this is pebkac but I haven't figure it out yet.
My current Mailman 3 code is buildout-based. The branch is here:
https://code.launchpad.net/~mailman-coders/mailman/3.0
Here's my buildout.cfg file:
-----snip snip----- [buildout] parts = interpreter tags test unzip = true develop = .
[interpreter] recipe = zc.recipe.egg interpreter = py eggs = lazr.config lazr.delegates locknix mailman munepy storm zope.interface
[tags] recipe = z3c.recipe.tag:tags eggs = mailman
[test] recipe = zc.recipe.testrunner eggs = mailman defaults = '--tests-pattern ^tests --exit-with-status'.split() # Hack in extra arguments to zope.testrunner. initialization = from mailman.testing.layers import ConfigLayer; ConfigLayer.hack_options_parser() -----snip snip-----
If I build this out and then run bin/test, my test suite passes, but I get ImportErrors for every dependent egg that gets downloaded. It's as if the eggs directory is being search for tests even though eggs=mailman is in the [test] section.
However, if I put the following in my ~/.buildout/default.cfg, I don't those ImportErrors, presumably because the eggs are so far distant that Zope's testrunner doesn't find them.
-----snip snip----- [buildout] eggs-directory=/Users/barry/.buildout/eggs download-cache=/Users/barry/.buildout/download-cache -----snip snip-----
Here's an excerpt from the bin/test output (with extra blank lines suppressed):
Test-module import failures: Module: eggs.lazr.config-1.1-py2.6.egg.lazr.config.tests ImportError: No module named eggs.lazr.config-1.1- py2.6.egg.lazr.config.tests Module: eggs.lazr.delegates-1.0-py2.6.egg.lazr.delegates.tests ImportError: No module named eggs.lazr.delegates-1.0- py2.6.egg.lazr.delegates.tests Module: eggs.zc.buildout-1.1.1-py2.6.egg.zc.buildout.tests ImportError: No module named eggs.zc.buildout-1.1.1- py2.6.egg.zc.buildout.tests Module: eggs.zc.buildout-1.1.1-py2.6.egg.zc.buildout.testselectingpython ImportError: No module named eggs.zc.buildout-1.1.1- py2.6.egg.zc.buildout.testselectingpython Module: eggs.zc.recipe.egg-1.1.0-py2.6.egg.zc.recipe.egg.tests ImportError: No module named eggs.zc.recipe.egg-1.1.0- py2.6.egg.zc.recipe.egg.tests Module: eggs.zc.recipe.testrunner-1.1.0- py2.6.egg.zc.recipe.testrunner.tests ImportError: No module named eggs.zc.recipe.testrunner-1.1.0- py2.6.egg.zc.recipe.testrunner.tests Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.common.tests.test_idatetime ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.common.tests.test_idatetime Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.common.tests.test_import_interfaces ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.common.tests.test_import_interfaces Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_adapter ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_adapter Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_advice ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_advice Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_declarations ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_declarations Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_document ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_document Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_element ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_element Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_interface ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_interface Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_odd_declarations ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_odd_declarations Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_sorting ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_sorting Module: eggs.zope.interface-3.5.0-py2.6-macosx-10.3- i386.egg.zope.interface.tests.test_verify ImportError: No module named eggs.zope.interface-3.5.0-py2.6- macosx-10.3-i386.egg.zope.interface.tests.test_verify Module: eggs.zope.testing-3.7.1-py2.6.egg.zope.testing.tests ImportError: No module named eggs.zope.testing-3.7.1- py2.6.egg.zope.testing.tests Module: eggs.zope.testing-3.7.1-py2.6.egg.zope.testing.testrunner.tests ImportError: No module named eggs.zope.testing-3.7.1- py2.6.egg.zope.testing.testrunner.tests
The same behavior occurs on Linux.
Does anybody have any suggestions for making bin/test work without putting your eggs outside the source tree? Or if it's not possible, I'll update my README.txt to explain that you have to have a ~/.buildout/default.cfg.
Thanks, Barry
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jan 21, 2009, at 1:34 AM, Ross Patterson wrote:
You might try the approach I used in the following:
Indeed, sticking my top-level package under 'src' fixes the problem. Perhaps it's the same as this bug: https://bugs.edge.launchpad.net/zope.testing/+bug/251759 - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iQCVAwUBSXf7MXEjvBPtnXfVAQJivQQArCEiHYI4X3TXt5TYyWgrlyfrC4OLWhzZ d2hbez6I8pox+sn93KZhcOKyFvnOT3HKLwQPRRUFnX8R45j6c7z+5kS+7oTKaja3 PXBTGjwA4owDTzRbr/marFFIRx7KTpJZLlTT+Hx0peqyBWxuQ6Zmidl49bIN5aHs Pxuss9S2e3M= =3Q7M -----END PGP SIGNATURE-----
participants (2)
-
Barry Warsaw
-
Ross Patterson