Skip to content
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

Add support for loading tests from eggs #41

Open
jpellerin opened this issue Dec 14, 2011 · 5 comments
Open

Add support for loading tests from eggs #41

jpellerin opened this issue Dec 14, 2011 · 5 comments
Assignees

Comments

@jpellerin
Copy link
Member

Support for loading tests from eggs should be added, so that eg.:

nosetests some-distribution.egg

will work. This should done via a plugin.

Google Code Info:
Issue #: 78
Author: [email protected]
Created On: 2007-08-11T14:54:59.000Z
Closed On:

@ghost ghost assigned jpellerin Dec 14, 2011
@jpellerin
Copy link
Member Author

A workaround is to install a project using

easy_install --always-unzip

Or from source using

python setup.py easy_install --always-unzip

Google Code Info:
Author: [email protected]
Created On: 2008-01-27T01:57:02.000Z

@jpellerin
Copy link
Member Author

See #150 for details on the current (broken) behavior with zipped eggs. nose fails to
load from zipped eggs, even when given the package name, not a .egg file.

Google Code Info:
Author: [email protected]
Created On: 2008-01-27T18:35:17.000Z

@jpellerin
Copy link
Member Author

This should be quite easy, in loadTestsFromNames you can use pkg_resources to return
a list of filenames from the zip. Essentially, pkg_resources will have unzipped the
whole thing, but thats the only way I can see other plugins getting a chance to
process things.

However, pkg_resources seems a bit braindead when getting the contents of packages
(see below). You can use pkg_resources.ZipProvider._index, but that looks a bit
private to me.

Has anyone had any luck with discovering what is in the package from the
pkg_resources public API?

In [96]: pkg_resources.resource_listdir('simplejson', 'tests')
Out[96]:
['test_indent.pyc',
...
'test_unicode.pyc']

In [97]: pkg_resources.resource_listdir('simplejson', '')
Out[97]: []

In [98]: pkg_resources.resource_listdir('simplejson', '')
Out[98]: []

In [99]: pkg_resources.resource_listdir('simplejson', '/')
Out[99]: []

Google Code Info:
Author: [email protected]
Created On: 2008-06-06T16:02:20.000Z

@jpellerin
Copy link
Member Author

Nose 0.10.3 fails to find tests even in unzipped eggs for me (testing PyMC). I notice this issue has not been
updated in some time. Has someone found a solution/workaround?

Google Code Info:
Author: [email protected]
Created On: 2008-09-19T02:53:51.000Z

@jpellerin
Copy link
Member Author

This issue seems to have been around for at least a year and is still unresolved as far as I can tell...

When you install an egg, setuptools explicitly changes the permissions of all *.py files to a+x (755), making
them executable. By default, nose refuses to search for tests in executable scripts, out of security concerns.
Nose therefore skips all the tests in the egg.

This behaviour can be overridden with a command-line option to nosetests (--exe), which solves the problem
for me. It still means that built-in tests of packages like numpy 1.3.0 do not work out of the box.

For more history on the issue, see http://mail.python.org/pipermail/distutils-sig/2008-April/009396.html

Regards,
Ludwig

Google Code Info:
Author: [email protected]
Created On: 2009-04-15T14:02:45.000Z

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

1 participant