nose-devs/nose — Issue #127: Test discovery fails when importing functions to test module
Author: jpellerin
Created: 2011-12-14 16:01:03+00:00
State: open

What steps will reproduce the problem?
1. Write module with a function which has the word 'test' in the name e.g

module uut.py
-----------------
def foo_test(parameter1, parameter2):
pass

2. Write a unit test for it
import unittest
from uut import foo_test

class Test(unittest.TestCase):

def testName(self):
foo_test('foo', 'bar')

3. Run test with nose

What is the expected output? What do you see instead?
I expect the test to execute without errors. Instead I get this output:

C:\Documents and Settings\matuusit\workspace\NoseDiscovery\src>nosetests tests
.E
======================================================================
ERROR: tests.uut_test.foo_test
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Apps\python\lib\site-packages\nose-0.11.4-py2.6.egg\nose\case.py", line 186, in runTest
self.test(*self.arg)
File "C:\Apps\python\lib\site-packages\nose-0.11.4-py2.6.egg\nose\util.py", line 634, in newfunc
return func(*arg, **kw)
TypeError: foo_test() takes exactly 2 arguments (0 given)

----------------------------------------------------------------------
Ran 2 tests in 0.000s

FAILED (errors=1)

What version of the product are you using? On what operating system?
nosetests-script.py version 0.11.4 on Windows XP

Please provide any additional information below.
I can work around this problem by importing the module and using:
uut.foo_test('foo', 'bar')

Google Code Info:
Issue #: 410
Author: uusitalo...@gmail.com
Created On: 2011-04-15T06:59:12.000Z
Closed On: 2011-04-15T13:04:58.000Z