问题
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