Skip to content

Commit

Permalink
Color the steps independently of the scenario
Browse files Browse the repository at this point in the history
- use the output of the individual steps to decide the output colour
  • Loading branch information
dsax7 committed Jun 24, 2020
1 parent 96039fd commit 48dee00
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pytest_bdd/gherkin_terminal_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ def pytest_runtest_logreport(self, report):
self._tw.write(report.scenario["name"], **scenario_markup)
self._tw.write("\n")
for step in report.scenario["steps"]:
step_markup = {'red': True} if step["failed"] else (
{"yellow": True} if step["skipped"] else {"green": True})
if self.config.option.expand:
step_name = self._format_step_name(step["name"], **report.scenario["example_kwargs"])
else:
step_name = step["name"]
self._tw.write(" {} {}\n".format(step["keyword"], step_name), **scenario_markup)
self._tw.write(" {} {}\n".format(step["keyword"], step_name), **step_markup)
self._tw.write(" " + word, **word_markup)
self._tw.write("\n\n")
else:
Expand Down

0 comments on commit 48dee00

Please sign in to comment.