PY-13645 BDD: Scenario name is cut out from step name

This commit is contained in:
Ilya.Kazakevich
2014-08-08 21:45:20 +04:00
parent 33e070f744
commit d3b0e684b6
2 changed files with 9 additions and 8 deletions
+3 -3
View File
@@ -27,7 +27,7 @@ def get_path_by_args(arguments):
assert os.path.exists(what_to_run), "{} does not exist".format(what_to_run)
if os.path.isfile(what_to_run):
base_dir = os.path.dirname(what_to_run) # User may point to the file directly
base_dir = os.path.dirname(what_to_run) # User may point to the file directly
return base_dir, what_to_run
@@ -178,9 +178,9 @@ class BddRunner(object):
num_of_steps = 0
for feature in self._get_features_to_run():
if feature.background:
num_of_steps += len(feature.background.steps) * len(feature.scenarios)
num_of_steps += len(list(feature.background.steps)) * len(list(feature.scenarios))
for scenario in feature.scenarios:
num_of_steps += len(scenario.steps)
num_of_steps += len(list(scenario.steps))
return num_of_steps
@abc.abstractmethod
+6 -5
View File
@@ -136,10 +136,11 @@ class _BehaveRunner(_bdd_utils.BddRunner):
element.location.file = element.location.filename # To preserve _bdd_utils contract
if isinstance(element, Step):
# Process step
step_name = "{} {}".format(element.keyword, element.name)
if is_started:
self._test_started(element.name, element.location)
self._test_started(step_name, element.location)
elif element.status == 'passed':
self._test_passed(element.name, element.duration)
self._test_passed(step_name, element.duration)
elif element.status == 'failed':
try:
trace = traceback.format_exc()
@@ -147,11 +148,11 @@ class _BehaveRunner(_bdd_utils.BddRunner):
trace = "".join(traceback.format_tb(element.exc_traceback))
if trace in str(element.error_message):
trace = None # No reason to duplicate output (see PY-13647)
self._test_failed(element.name, element.error_message, trace)
self._test_failed(step_name, element.error_message, trace)
elif element.status == 'undefined':
self._test_undefined(element.name, element.location)
self._test_undefined(step_name, element.location)
else:
self._test_skipped(element.name, element.status, element.location)
self._test_skipped(step_name, element.status, element.location)
elif not is_started and isinstance(element, Scenario) and element.status == 'failed':
# To process scenarios with undefined/skipped tests
for step in element.steps: