I have a class Foo which lives in Src/Projects/SomeProject/Foo.py
I have a class FooTest(unittest.TestCase) which lives in:
Src/Projects/SomeProject/tests/FooTest.py
When I run it with pytest (I just type ‘py.test’ in Src to run all tests), I get:
def setUp(self):
self.foo = Foo()
TypeError: 'module' object is not callable
(I have from Foo import Foo in FooTest.py and Foo.py is in sys.path.
But when I run it with python: python Src/Projects/SomeProject/tests/FooTest.py everything works.)
Also, if I just move FooTest.py to Src/Projects/SomeProject then running with py.test suddenly works.
Any ideas?
You need to check your python path; some other
Foo.Foois being found before your moduleFoo.Alternatively, in a
try/except TypeErrorsuite, print out the path of the offending module: