Getting nose to NOT discover setup module?

76 views
Skip to first unread message

Roy Smith

unread,
May 25, 2013, 11:20:03 PM5/25/13
to nose-...@googlegroups.com
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 nosetests at the top level, it discovers foo/setup and tries to run it:

$ nosetests
E
======================================================================
ERROR: test suite for <module 'foo' from '/home/roy/play/nose/foo/__init__.pyc'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/roy/production/python/local/lib/python2.7/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/home/roy/production/python/local/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/home/roy/production/python/local/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/home/roy/production/python/local/lib/python2.7/site-packages/nose/util.py", line 464, in try_run
    (name, obj))
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.

----------------------------------------------------------------------
Ran 0 tests in 0.002s

FAILED (errors=1)

How can I prevent it from doing this?  I've tried various combinations of __test__ = False in foo/__init__.py and foo/setup/__init__.py, with no effect.  I'm running nose 1.3.0.

Reply all
Reply to author
Forward
0 new messages