我有一个包含 python 脚本的文件夹,其中包含我想要对其进行单元测试的文档测试。当我尝试使用这样的一个文件对其进行测试时:
import unittest
suite = unittest.TestSuite()
suite.addTest('/homes/ndeklein/workspace/MS/PyMS/pyMS/baseFunctions.py')
unittest.TextTestRunner().run(suite)
我收到此错误:
TypeError: the test to add must be callable
但是,当我从命令行执行此操作时
python '/homes/ndeklein/workspace/MS/PyMS/pyMS/baseFunctions.py'
有用。
如何使我的文件可调用?