nosetest uses heuristics to identify which functions are testcases. This can get awkward when importing a method with an ambiguous name for testing, e.g.:
foo/foo.py
def get_test_case(text):
return "xyz"
(Note directory foo is excluded, this is not about nosetests identifying foo/foo.py as a testcase)
tests/test_foo.py
import unittest
# causes TypeError: get_test_case() missing 1 required positional argument: 'text'
from foo.foo import get_test_case
class TestTestCasesReader(unittest.TestCase):
def test_get_test_case(self):
self.assertEquals(get_test_case("fooBar"), ...)
I know I can do this workaround in the test:
import unittest
import foo.foo
# ...
self.assertEquals(foo.get_test_case("fooBar"), ...)
but it feels like there should be a better way to tell nosetest to lay off that get_test_case
function.
Obviously I could also rename get_test_case
to hide it from nosetests, that's not the answer I am looking for though.