pytest 9.0.3 · pytest-given 0.1.0 ·
Basic scenario with when/then and a JSON attachment billing happy-path
✓ passed 0ms
Given
a coffee machine
When
I insert $2
Then
I get a coffee
Machine state
{
  "coffees": 9,
  "price": 2
}
Plain text attachment billing
✓ passed 0ms
Given
a coffee machine
When
I print the receipt
Then
the receipt is recorded verbatim
Receipt
Coffee x1     $2.00
----------------
Total:        $2.00
Generator fixture with teardown
✓ passed 0ms
Given
a database connection
When
I run a query
Then
the connection is open and the query was logged
T-string with a non-parametrize value (neutral highlight)
✓ passed 0ms
Given
a coffee machine
I have some coins in hand
When
I insert $5
Then
the machine has 9 coffees left
Helper functions can record their own steps billing
✓ passed 0ms
Given
a coffee machine
When
I insert $2
the coin is validated for $2
the balance is updated
Then
the coin is accepted
a coffee is dispensed
the machine state is consistent
Final state
{
  "coffees": 9,
  "price": 2
}
Top-level `given` block and deeply nested steps billing
✓ passed 0ms
Given
a coffee machine
a loyalty card with 5 points
When
I place a large order
I select 3 coffees
I apply loyalty discount
the loyalty card is validated
the discount is calculated
Then
the order is processed correctly
the coffee count is updated
the loyalty points are deducted
the remaining points are valid
Loyalty state
{
  "points": 2
}
the machine state is consistent
Final machine state
{
  "coffees": 7,
  "price": 2
}
Failure rendering (intentionally failing)
✗ failed 96ms
Given
a coffee machine
Then
the machine has 20 coffees
assert 10 == 20
.nox/examples/Lib/site-packages/_pytest/runner.py:353: in from_call
    result: TResult | None = func()
                             ^^^^^^
.nox/examples/Lib/site-packages/_pytest/runner.py:245: in <lambda>
    lambda: runtest_hook(item=item, **kwds),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/_pytest/logging.py:850: in pytest_runtest_call
    yield
.nox/examples/Lib/site-packages/_pytest/capture.py:900: in pytest_runtest_call
    return (yield)
            ^^^^^
.nox/examples/Lib/site-packages/_pytest/skipping.py:268: in pytest_runtest_call
    return (yield)
            ^^^^^
.nox/examples/Lib/site-packages/_pytest/runner.py:179: in pytest_runtest_call
    item.runtest()
.nox/examples/Lib/site-packages/_pytest/python.py:1720: in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
.nox/examples/Lib/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/_pytest/python.py:166: in pytest_pyfunc_call
    result = testfunction(**testargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^
src/pytest_given/capture/decorators.py:191: in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
examples/test_examples.py:143: in test_failing
    assert machine['coffees'] == 20
E   assert 10 == 20
Skipped scenario rendering
○ skipped 27ms
Skipped: demonstrates skipped status
demonstrates skipped status
.nox/examples/Lib/site-packages/_pytest/runner.py:353: in from_call
    result: TResult | None = func()
                             ^^^^^^
.nox/examples/Lib/site-packages/_pytest/runner.py:245: in <lambda>
    lambda: runtest_hook(item=item, **kwds),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
    return result.get_result()
           ^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
    res = yield
          ^^^^^
.nox/examples/Lib/site-packages/_pytest/logging.py:843: in pytest_runtest_setup
    yield
.nox/examples/Lib/site-packages/_pytest/capture.py:895: in pytest_runtest_setup
    return (yield)
            ^^^^^
.nox/examples/Lib/site-packages/_pytest/skipping.py:251: in pytest_runtest_setup
    raise skip.Exception(skipped.reason, _use_item_location=True)
E   Skipped: demonstrates skipped status
Parameterized test (renders as a parameter table) billing
✓ passed 0ms
Given
a coffee machine
When
I insert ${euros}
Then
the purchase is allowed: {expect}
euros expect status
1 False
2 True
3 True
Brew {cup_size} ml (templated scenario name) billing
✓ passed 0ms
Given
a coffee machine
When
I brew a {cup_size} ml cup
Then
the machine has one fewer coffee
cup_size status
200
300
All cases skipped
○ skipped 56ms
n status
1
awaiting fixture
.nox/examples/Lib/site-packages/_pytest/runner.py:353: in from_call
    result: TResult | None = func()
                             ^^^^^^
.nox/examples/Lib/site-packages/_pytest/runner.py:245: in <lambda>
    lambda: runtest_hook(item=item, **kwds),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
    return result.get_result()
           ^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
    res = yield
          ^^^^^
.nox/examples/Lib/site-packages/_pytest/logging.py:843: in pytest_runtest_setup
    yield
.nox/examples/Lib/site-packages/_pytest/capture.py:895: in pytest_runtest_setup
    return (yield)
            ^^^^^
.nox/examples/Lib/site-packages/_pytest/skipping.py:251: in pytest_runtest_setup
    raise skip.Exception(skipped.reason, _use_item_location=True)
E   Skipped: awaiting fixture
2
awaiting fixture
.nox/examples/Lib/site-packages/_pytest/runner.py:353: in from_call
    result: TResult | None = func()
                             ^^^^^^
.nox/examples/Lib/site-packages/_pytest/runner.py:245: in <lambda>
    lambda: runtest_hook(item=item, **kwds),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
    return result.get_result()
           ^^^^^^^^^^^^^^^^^^^
.nox/examples/Lib/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
    res = yield
          ^^^^^
.nox/examples/Lib/site-packages/_pytest/logging.py:843: in pytest_runtest_setup
    yield
.nox/examples/Lib/site-packages/_pytest/capture.py:895: in pytest_runtest_setup
    return (yield)
            ^^^^^
.nox/examples/Lib/site-packages/_pytest/skipping.py:251: in pytest_runtest_setup
    raise skip.Exception(skipped.reason, _use_item_location=True)
E   Skipped: awaiting fixture