difference between "nosetests test_x.py" and "nosetests test_x"?

15 views
Skip to first unread message

Roy Smith

unread,
Dec 28, 2012, 11:46:32 AM12/28/12
to nose-...@googlegroups.com
I have a trivial test file:

$ cat test_x.py
import test_common

def test_foo():
    pass

If I run "nosetests test_x.py", it runs fine.  If, however, I run "nosetests test_x", it fails when it tries to run the import (see below).  I don't understand what's happening here.

$ nosetests test_x
E
======================================================================
ERROR: Failure: ImportError (No module named test_common)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/roy/production/python/local/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/roy/production/python/local/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/roy/production/python/local/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/roy/songza/api2/test_x.py", line 1, in <module>
    import test_common
ImportError: No module named test_common

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)


Reply all
Reply to author
Forward
0 new messages