'Running pytest-bdd using pytest.main
I am looking to run pytest-bdd tests and traditional pytest tests in the same automation framework. I feed in test data, including the module I want to run represented as a string. Making things as dynamic as I can. I do NOT want to exit python at the end of a test. For the traditional pytest tests, I use pytest.main() to invoke pytest inside my python test execution code. Using pytest.main() allows the python app to stay alive regardless of pass/fail. I am trying to do the same for pytest-bdd scripts
I can't seem to import a bdd module using:
module = importlib.import_module(modulePath)
I have traced this down to the @scenario decorator executing before the module can be returned. Does pytest-BDD have a mechanism that allows the scenario to be "declared/defined" in a function as opposed to an annotation that gets executed immediately ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
