mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 10:59:17 +00:00
f08dba6483
I've been spoilt by tools like Behat and so this make it much nicer because it tells you exactly the feature/scenario/step where it failed.
20 lines
612 B
Python
20 lines
612 B
Python
import pytest
|
|
|
|
# pytest by default doesn't print steps and where it failed. Let's fix that.
|
|
|
|
|
|
@pytest.hookimpl
|
|
def pytest_bdd_before_scenario(request, feature, scenario):
|
|
print(f"\033[94m# {feature.name}\033[0m")
|
|
print(f"\033[94m## {scenario.name}\033[0m")
|
|
|
|
|
|
@pytest.hookimpl(tryfirst=True)
|
|
def pytest_bdd_after_step(request, feature, scenario, step, step_func, step_func_args):
|
|
print(f"\033[92m>>> {step.name}\033[0m")
|
|
|
|
|
|
@pytest.hookimpl(tryfirst=True)
|
|
def pytest_bdd_step_error(request, feature, scenario, step, step_func, step_func_args):
|
|
print(f"\033[1;91m>>> {step.name} <-- FAILED\033[0m")
|