MCPcopy Create free account
hub / github.com/pytest-dev/pytest-bdd / test_step_trace

Function test_step_trace

tests/feature/test_steps.py:463–574  ·  view source on GitHub ↗

Test step trace.

(pytester)

Source from the content-addressed store, hash-verified

461
462
463def test_step_trace(pytester):
464 """Test step trace."""
465 pytester.makeini(
466 """
467 [pytest]
468 console_output_style=classic
469 """
470 )
471
472 pytester.makefile(
473 ".feature",
474 test="""
475 Feature: StepHandler hooks
476 Scenario: When step has hook on failure
477 Given I have a bar
478 When it fails
479
480 Scenario: When step's dependency a has failure
481 Given I have a bar
482 When its dependency fails
483
484 Scenario: When step is not found
485 Given not found
486
487 Scenario: When step validation error happens
488 Given foo
489 And foo
490 """,
491 )
492 pytester.makepyfile(
493 """
494 import pytest
495 from pytest_bdd import given, when, scenario
496
497 @given('I have a bar')
498 def _():
499 return 'bar'
500
501 @when('it fails')
502 def _():
503 raise Exception('when fails')
504
505 @pytest.fixture
506 def dependency():
507 raise Exception('dependency fails')
508
509 @when("its dependency fails")
510 def when_dependency_fails(dependency):
511 pass
512
513 @scenario('test.feature', "When step's dependency a has failure")
514 def test_when_dependency_fails():
515 pass
516
517 @scenario('test.feature', 'When step has hook on failure')
518 def test_when_fails():
519 pass
520

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…