Reputation: 73
I am running behave from python like this.
from behave.__main__ import main as behave_main
behave_main('path/to/feature_file.feature -f json -o /path/to/logs/here )
When there feature file path is missing it fails with error
ConfigError: No steps directory in "'path/to/feature_file.feature"
I want to handle this exception in python.
I tried with expect ConfigError
It's not capturing it.
Upvotes: 0
Views: 1534
Reputation: 2061
You've got to import the ConfigError
in order to expect it.
from behave.__main__ import main as behave_main
from behave.configuration import ConfigError
try:
behave_main('path/to/feature_file.feature -f json -o /path/to/logs/here')
except ConfigError:
print("Caught it!")
Upvotes: 1