ImportError: cannot import name #108

Open
jpellerin opened this Issue Dec 14, 2011 · 1 comment

Comments

Projects
None yet
1 participant
@jpellerin
Member

jpellerin commented Dec 14, 2011

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:

@jpellerin

This comment has been minimized.

Show comment
Hide comment
@jpellerin

jpellerin Dec 14, 2011

Member

Also, just to be sure my tests are not the problem, I have to add that pytest is able
to run all my tests with no errors.

And that even though Nose is giving ImportError exceptions all tests pass.

Google Code Info:
Author: alfredodeza
Created On: 2010-04-08T14:22:14.000Z

Member

jpellerin commented Dec 14, 2011

Also, just to be sure my tests are not the problem, I have to add that pytest is able
to run all my tests with no errors.

And that even though Nose is giving ImportError exceptions all tests pass.

Google Code Info:
Author: alfredodeza
Created On: 2010-04-08T14:22:14.000Z

@ghost ghost assigned jpellerin Dec 14, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment