Run python behave from python instead of command line

廉价感情. 提交于 2019-12-06 02:48:57

问题


Is there any way to run python behave from within python and not via command line?

default usage: run behave command in base folder with features/steps

desired usage: call a function (or have a certain import) which executes the behave tests in a specified folder


回答1:


Found the solution by working through the behave source code:

from behave.__main__ import main as behave_main
behave_main("path/to/specified/folder")

The main method of behave enumerates and processes all paths it finds in its arguments.



来源:https://stackoverflow.com/questions/28829350/run-python-behave-from-python-instead-of-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!