Preventing nose from discovering a package named “

2019-06-24 08:05发布

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条回答
一纸荒年 Trace。
2楼-- · 2019-06-24 09:01

Did you try the -I (--ignore-files) flag in the command line?

查看更多
登录 后发表回答