问题
I've got a directory tree that looks like:
$ find . -name '*.py' -ls
1315965 4 -rw-rw-r-- 1 roy roy 16 May 25 23:09 ./foo/__init__.py
1445517 4 -rw-rw-r-- 1 roy roy 16 May 25 23:09 ./foo/setup/__init__.py
When I run nose, it imports foo.setup, believes it's a fixture, and attempts to run it, resulting in:
TypeError: Attribute setup of <module 'foo' from '/home/roy/play/nose/foo/__init__.pyc'> is not a python function. Only functions or callables may be used as fixtures.
Is there some way to tell nose not to do that? I tried putting __test__ = False
in both foo/__init__.py
and foo/setup/__init__.py
, to no effect.
回答1:
Did you try the -I (--ignore-files) flag in the command line?
来源:https://stackoverflow.com/questions/16758773/preventing-nose-from-discovering-a-package-named-setup