1
我有一個包含文檔測試的python腳本的文件夾,我想對其進行單元測試。當我試着使用一個文件中像這樣來測試它:Unittest和doctest,如何使我的文件可調用?
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'
它的工作原理做。
如何讓我的文件可調用?