nose
nose copied to clipboard
Certain directory structure causes nose test to fail
I have detected that if you have following structure of files:
<ROOT>
|
| - tests/test_main.py
| - app/task/__init__.py
| - app/tools/__init__.py
| - app/tools/setup.py
| - app/tools/something/__init__.py
All files are empty except task that imports setup like that from app.tools import setup
.
Run nosetests 1.3.7 from root directory, without any extra parameter with python either 2.7.x and 3.5.x and you will get following exception:
TypeError: Attribute setup of <module 'app.tools' from '/home/dariuszwiatrak/Projects/nose-bug/app/tools/__init__.py'> is not a python function. Only functions or callables may be used as fixtures.
Fun fact if you rename setup into something else it works, if you stop importing setup in task/init.py it works and finally if you remove app/tools/something/__init__.py
it works.
I have created repository with a bug, clone it and run nosetest to observe it:
https://github.com/Drachenfels/nose-bug/tree/master
Using nose-exclude on the module with the setup.py is a temporary work around:
nosetests --exclude-dir=app/tools