(Posted on behalf of Martin Williams, a solar car enthusiast who is working on OLM this summer.)
I was having a problem running nosetests with the code coverage option enabled---in the coverage report, one of the source files reported exceptions.SyntaxError: invalid syntax (line 1) where it should have detailed which lines had not been executed in that file during the test run. Line 1 in the file read import turbogears, which is perfectly valid Python.
After a bit of searching I found a few pages referencing this error, but nothing in relation to nose or code coverage, and nothing that suggested a fix for it that made sense. Then I stumbled across this post. Fortunately my Japanese was good enough to read it. The author had a similar problem with Twisted, and after thinking about it for a bit, and eating some mochi, he figured it out---the line endings in the file were CRLF, rather than just LF, and the parser didn't like that.
Switching the line endings back to Unix style fixed the problem, so now I can see that only 39% of the file is covered. So, let's hear it for sticky rice cake...
comments powered by Disqus