You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pytest caplog fixture enables the capture of logs so they can be used in assertions.
It seems that py.test bdd steps are capturing out streams somehow so this information is lost. An example of test that fails:
"""we can verify logs feature tests."""importloggingfrompytest_bddimport (
scenario,
then,
when,
)
@scenario('log.feature', 'Logs are retrieved')deftest_logs_are_retrieved():
"""Logs are retrieved."""@when('user performs an auditable action', target_fixture="logs")def_(caplog):
"""user performs an auditable action."""logging.info("log this")
returncaplog@then('action is audited')def_(logs):
"""action is audited."""assertlogs.records
The text was updated successfully, but these errors were encountered:
pytest caplog fixture enables the capture of logs so they can be used in assertions.
It seems that py.test bdd steps are capturing out streams somehow so this information is lost. An example of test that fails:
The text was updated successfully, but these errors were encountered: