nose-devs/nose — Issue #447: pyx files do not have a package, and doctests will not print if they fail
Author: jpellerin
Created: 2011-12-14 16:11:48+00:00
State: open

What steps will reproduce the problem?
1. Write a cython extension (pyx) with a doctest that fails in a libaray.
2. Compile library, generating a .so file from pyx file.
3. Run nose tests on said library.
4. Tests run, but when printing out the problems, the following happens:
File "/usr/local/lib/python2.7/dist-packages/nose/plugins/doctests.py", line 366, in id
if not name.startswith(pk):
TypeError: expected a character buffer object

What is the expected output? What do you see instead?
Doctest details

What version of the product are you using? On what operating system?
1.0.0, but the discriminating code is on the most recent version.

This fails because the extension is not .py. This causes the nose/util/getpackage function to return None, which fails when passed to str().startswith. I don't know if getpackage will work properly in the case of non-py files, so getpackage returning None is probably valid. However the DocTestCase.id function should probably handle the case when pk is None a bit better. As a suggestion:
if pk is None: pk = ""
Or something more valid.

Google Code Info:
Issue #: 453
Author: robertla...@gmail.com
Created On: 2011-09-05T11:07:03.000Z
Closed On: