Preventing nose from discovering a package named “setup”?

别等时光非礼了梦想. 提交于 2020-01-14 12:17:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!