Random Linux Garble.

Python Nose: ImportError: Cannot Import Name

Was running tests this week with Jenkins and Nose on a number of tests in my “tests” directory. For some reason one of my test files kept getting passed up when I ran nosetests on the entire directory. When consulting the google, I only found one other complaint of this, on a google code issue now ported over to github issues.

While this doesnt tell how to deal with it, or give any resolution whatsoever, it lets me know that this is something that has yet to be resolved. I got around it by just running a for loop in the shell area in the Jenkins job.

for file in `ls | grep '^test.*.py$'`; do   
       nosetests -v --with-xunit --xunit-file=$file.xml $file;  

Had to name the xml files dynamically or they get overwritten, but that shouldn’t matter as long as you just glob the target *.xml in the config section of the Jenkins job.