| 1 |
import pytest |
| 2 |
|
| 3 |
# pytest by default doesn't print steps and where it failed. Let's fix that. |
| 4 |
|
| 5 |
|
| 6 |
@pytest.hookimpl |
| 7 |
def pytest_bdd_before_scenario(request, feature, scenario): |
| 8 |
print(f"\033[94m# {feature.name}\033[0m") |
| 9 |
print(f"\033[94m## {scenario.name}\033[0m") |
| 10 |
|
| 11 |
|
| 12 |
@pytest.hookimpl(tryfirst=True) |
| 13 |
def pytest_bdd_after_step(request, feature, scenario, step, step_func, step_func_args): |
| 14 |
print(f"\033[92m>>> {step.name}\033[0m") |
| 15 |
|
| 16 |
|
| 17 |
@pytest.hookimpl(tryfirst=True) |
| 18 |
def pytest_bdd_step_error(request, feature, scenario, step, step_func, step_func_args): |
| 19 |
print(f"\033[1;91m>>> {step.name} <-- FAILED\033[0m") |