8000 sklearn/ball_tree.so has no package name · Issue #342 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

sklearn/ball_tree.so has no package name #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robertlayton opened this issue Sep 5, 2011 · 11 comments
Closed

sklearn/ball_tree.so has no package name #342

robertlayton opened this issue Sep 5, 2011 · 11 comments
Milestone

Comments

@robertlayton
Copy link
Member

tl;dr nose doesn't give a package name for .pyx files, so ball_tree.so fails when printing out results of doctests. Recommend moving doctests to specific test module instead.

Long version
When running the tests with from sklearn import test; test(verbose=3), the test run great, but when printing out the results, I get an error on this line in nose/plugins/doctests.py:

 def id(self):
        name = self._dt_test.name
        filename = self._dt_test.filename
        if filename is not None:
            pk = getpackage(filename)
            if not name.startswith(pk):
                name = "%s.%s" % (pk, name)
        return name

If I print pk, filename just above the second if statement, I find out the error happens when dealing with printing out the doctest error for nose/plugins/doctests.py:

None /usr/local/lib/python2.7/dist-packages/scikit_learn-0.9_git-py2.7-linux-i686.egg/sklearn/ball_tree.so

So the error is basically, that ball_tree.so has doctests, but no package name. This is because on line 273 in nose/util.py, there is a line:

if not src_file.endswith('.py') and not ispackage(src_file):
        return None

In other words, if its not a .py file, it won't have a package name. I checked the latest source for nose, and this is still there, so my version of nose is not out of date.

If nobody else is getting these, its probably because these tests fail on my computer, and hence nose needs to print out the details. However showing failed tests is important, so these should probably be moved to a specific test module so that they do print out when they fail.

thoughts?

@robertlayton
Copy link
Member Author

I've submitted a bug report to nose, but I still think it would be wise to move the doctests. I'm happy to do it (I think it would be easy enough), but I'd like to get opinions, particularly if others are getting same error, first.

@ogrisel
Copy link
Member
ogrisel commented Sep 5, 2011

I don't know. I still think that those doctests serve as good usage examples and removing them from the docstring is a bit annoying. Wouldn't it be possible to hack sklearn.test to skip the pyx files?

@robertlayton
Copy link
Member Author

That is another option. Can the doctests be edited so that they look like code, but aren't picked up by nose? That would be more explicit than adding exceptions to .test

@jakevdp
Copy link
Member
jakevdp commented Sep 5, 2011

I don't know. I still think that those doctests serve as good usage examples and removing them from the
docstring is a bit annoying. Wouldn't it be possible to hack sklearn.test to skip the pyx files?

+1 on somehow keeping these as examples. I think it might be as simple as adding #doctest: +SKIP to the top line of each example, though I've never tried using that directive.

@ogrisel
Copy link
Member
ogrisel commented Sep 5, 2011

I think you have to put this on each line... but I would be glad to be proved wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fabianp
Copy link
Member
fabianp commented Sep 19, 2011

Had to comment them out for the release (56a0392) but this still needs to be fixed.

@amueller
Copy link
Member

Stackoverflow has also something to say on this issue:
http://stackoverflow.com/questions/1809037/python-doctest-skip-entire-block
It seems olivier is right. There only seems to be hacky solutions to not run the doctest.

@robertlayton
Copy link
Member Author

On 17 December 2011 04:50, Andreas Mueller <
reply@reply.github.com

wrote:

Stackoverflow has also something to say on this issue:
http://stackoverflow.com/questions/1809037/python-doctest-skip-entire-block
It seems olivier is right. There only seems to be hacky solutions to not
run the doctest.


Reply to this email directly or view it on GitHub:

#342 (comment)

Ugh, that isn't a good solution (but it seems to be the best we have).

Public key at: http://pgp.mit.edu/ Search for this email address and select
the key from "2011-08-19" (key id: 54BA8735)

@amueller
Copy link
Member

Err... which one? The one defining a function and not calling it seems to be the best to me.

@robertlayton
Copy link
Member Author

I meant the per line option. The function is a decent workaround
On Dec 17, 2011 8:02 AM, "Andreas Mueller" <
reply@reply.github.com>
wrote:

Err... which one? The one defining a function and not calling it seems to
be the best to me.


Reply to this email directly or view it on GitHub:

#342 (comment)

@amueller
Copy link
Member
amueller commented Jan 7, 2012

Closing for the moment. I guess we have to wait for nose to really fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
0