试图把一个命令参数传给我的西装脚本:
from test_cases.test_quick_search import QuickSearchTest
args = ['-s --tc=url:https://our_dev_environment.co']
def run_suite():
all_tests = TestLoader().loadTestsFromTestCase(QuickSearchTest)
suite = LazySuite(all_tests)
run(args,suite=suite)
if __name__ == '__main__':
run_suite()
但它似乎没有任何作用
是
QuickSearchTest
aunittest.TestCase子类?loadTestsFromTestCase将只找到TestCase
子类中的测试。您可以查看all_tests
的内容,看看它是否真的从模块/类加载了任何内容。在假设
run()
是nosetestsrun,那么使用suite
会带来一个非常严重的警告:通过手工组装和运行自己的测试,你会损失很多nosetest实用程序(在模块和类级别设置/拆卸等等)。在
run
接受suite
的测试列表,因此您可以在调用它时尝试使用suite= all_tests
。在或者,this SO answer可能会有帮助。在
相关问题 更多 >
编程相关推荐