[Distutils] Path problem with zope.testing and buildout

Ross Patterson me at rpatterson.net
Wed Jan 21 07:34:12 CET 2009


You might try the approach I used in the following:

http://rpatterson.net/blog/running-tests-in-egg-buildouts

Ross

Barry Warsaw <barry at 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 at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig



More information about the Distutils-SIG mailing list