numpy.testing.run_module_suite

testing.run_module_suite(file_to_run=None, argv=None)[源代码]

运行测试模块。

相当于呼叫 $ nosetests <argv> <file_to_run> 从命令行

参数
file_to_run可选的STR

测试模块路径,或无路径。默认情况下,运行从中调用此函数的模块。

argv字符串表

要传递给前端测试运行程序的参数。 argv[0] 被忽略。接受的所有命令行参数 nosetests 会工作。如果它是默认值none,则使用sys.argv。

1.9.0 新版功能.

实例

添加以下内容:

if __name__ == "__main__" :
    run_module_suite(argv=sys.argv)

当在Python解释器中调用该模块时,测试模块将在测试结束时运行测试。

或者,拨打:

>>> run_module_suite(file_to_run="numpy/tests/test_matlib.py")  

从解释器将运行“test-matlib.py”中的所有测试例程。