progrium / ginkgo

Python service microframework
http://ginkgo.readthedocs.org
MIT License
325 stars 48 forks source link

any *.conf.py file in source tree breaks nosetests #67

Open hblanks opened 12 years ago

hblanks commented 12 years ago

During a recent code review, I mentioned that Ginkgo's current configuration file standard, where configuration files end in .conf.py, causes nose tests to break. Here's how you may reproduce it:

$ nosetests

----------------------------------------------------------------------
Ran 0 tests in 0.009s

OK
$ touch ginkgo/test.conf.py
$ nosetests
E
======================================================================
ERROR: Failure: ImportError (No module named ginkgo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/hblanks/virtualenv/main/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/hblanks/virtualenv/main/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/hblanks/virtualenv/main/lib/python2.7/site-packages/nose/importer.py", line 71, in importFromDir
    fh, filename, desc = find_module(part, path)
ImportError: No module named ginkgo

----------------------------------------------------------------------
Ran 1 test in 0.010s

FAILED (errors=1)
$ 

This example uses the current ginkgo source tree and the latest version of nose. It's worth noting that any source tree should cause this behavior, provided you've put a *.conf.py file inside a directory that nose is going to search.

(My unsolicited two cents here is that Ginkgo files would be better either just as .py files, or else as INI-formatted .conf files, akin to CherryPy's.)