Okay. I narrowed the problem down and created a minimal test case. I created two projects, myns.projA and myns.projB. myns.projA is stock basic_namespace project with one module added. First, I created myns.projA with the basic_namespace template from ZopeSkel:
paster create -t basic_namespace Selected and implied templates: zopeskel#basic_namespace A project with a namespace package
cat > myns.projA\myns\projA\modA.py def funcA():
Enter project name: myns.projA Variables: egg: myns.projA package: mynsproja project: myns.projA Enter namespace_package (Namespace package (like plone)) ['plone']: myns Enter package (The package contained namespace package (like example)) ['example']: projA ... (rest are defaults) Then I added a single module with a simple function print "funcA called" ^D myns.projB is another project created basically the same way, but they key to getting the bug to surface was to put the packages in a sub-directory... so I modified setup.py with the following parameters to setup: packages=find_packages('src'), package_dir={'': 'src'}, test_suite='nose.collector', And of course, I moved the myns directory to src/myns. Note, this only had to happen for myns.projB. Finally, I created a test directory and a file testBasic.py
cat > test/testBasic.py from myns.projA.modA import funcA ^D
Note, I could add a dependency from myns.projB on myns.projA, but it's not necessary for this demonstration. Then, I either setup myns.projA with either "install" or "develop" so that it's visible to the Python installation. Thereafter, if I try to run "setup.py test" on myns.projB, I get the ImportError. See error.txt, attached, for the transcript. I've also attached the two test packages as described. I notice now that the error appears to only occur when nose.collector is used... and when the package_dir of the child package is overridden. Perhaps this needs to go to the nose project and instead of the distutils project. Please advise on what I might do next to help resolve this issue. Obviously I could restructure my projects to avoid the problem, but I would much rather help resolve the problem, as I suspect it may affect other users' deployments as well. Much obliged, Jason -----Original Message----- From: Phillip J. Eby [mailto:pje@telecommunity.com] Sent: Friday, 20 June, 2008 08:46 To: Jason R. Coombs; distutils-sig@python.org Subject: Re: [Distutils] ImportError running 'test' on namespace package - other package in namespace not found At 08:07 PM 6/18/2008 -0600, Jason R. Coombs wrote:
If there's not something obvious I should be doing differently, I'm happy to put together a minimal test case that reproduces the problem.
Please do. Thanks!