nose-devs/nose — Issue #293: test can't be run from package directory -- misleading INFO message
Author: jpellerin
Created: 2011-12-14 16:06:42+00:00
State: open

I have a small module, i.e. a dir (say, package/) which has an init.py, a
foo.py and a test_foo.py test_foo.py has the line 'import foo' in it, as it
contains the test code for the code in foo.py

I try to run the tests by running 'nosetests -vv' in the dir. I see the
line "nose.core: INFO: Working directory is a package; adding to sys.path"
appear, but the tests won't run, I get an ImportError?: No module named foo

The problem is that the message "Working directory is a package; adding to
sys.path" is misleading. I doesn't add the current directory, it adds the
_parent_ of the current directory to sys.path. (Due to the way add_path()
is implemented in sys.path)

I'm not sure how to characterise this problem. Simply having 'import
package.foo' instead of 'import foo' in test_foo.py makes it work. Is there
any reason to prohibit using 'import foo' in this case? Or maybe using
add_path() for adding the current working directory is a bug?

Google Code Info:
Issue #: 15
Author: jpelle...@gmail.com
Created On: 2006-12-20T02:25:44.000Z
Closed On: 2007-01-14T01:29:37.000Z