Ticket #112 (assigned)
test can't be run from package directory -- misleading INFO message
| Priority: | low | Reporter: | guest |
|---|---|---|---|
| Severity: | normal | Assigned to: | jpellerin (accepted) |
| Component: | nose | Status: | assigned |
| Version: | Resolution: | ||
| Milestone: | 0.9.2 | Keywords: |
Description by guest:
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?
Changelog
Wed Dec 13 10:07:28 2006: Modified by jpellerin
- milestone set to 0.9.2
- priority changed from normal to low
- status changed from new to assigned
