nose-devs/nose — Issue #108: ImportError: cannot import name
Author: jpellerin
Created: 2011-12-14 15:59:34+00:00
State: open

What steps will reproduce the problem?
1. Within a 'tests' directory run 'nosetests -v'
2. Even though all tests pass I get: Failure: ImportError (cannot import
name ****)

What is the expected output? What do you see instead?
Expected output should be no import errors since the test file is able to
run when called directly from nose, like:
"nosetests -v test_foo.py"
The import errors come up only when no specific file is being called, but
rather all the tests files (e.g. using auto-discovery) in the 'tests'
directory.

What version of the product are you using? On what operating system?
0.11.3

Please provide any additional information below.
This is the tracback I am getting when I run all the tests in the test
directory:
======================================================================
ERROR: Failure: ImportError (cannot import name permissions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/nose/loader.py", line 382,
in loadTestsFromName
addr.filename, addr.module)
File "/usr/local/lib/python2.6/dist-packages/nose/importer.py", line 39,
in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/local/lib/python2.6/dist-packages/nose/importer.py", line 86,
in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/alfredo/pacha/tests/test_permissions.py", line 10, in

from lib import hg, database, permissions
ImportError: cannot import name permissions

However, If I run nosetests for that same file, no errors come up:

nosetests test_permissions.py
..........
----------------------------------------------------------------------
Ran 10 tests in 0.639s

OK

Google Code Info:
Issue #: 330
Author: alfredodeza
Created On: 2010-04-08T14:18:30.000Z
Closed On: