4

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.

Roy Smith
  • 2,039
  • 3
  • 20
  • 27

1 Answers1

1

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

gb.
  • 646
  • 5
  • 11
  • That seems like it would work, thanks. As it turns out, we ended up reorganizing the code tree to avoid this problem, but I'll keep --ignore-files in mind the next time it comes up. – Roy Smith May 27 '13 at 14:42
  • For me I used `./manage.py test --ignore-files setup.py` Thanks! – Montaro Jan 05 '17 at 11:16