I've recently encountered a problem with allure.step-wrapped function in pytest_generate_tests -- they fail with ugly trace like
==================================== ERRORS ====================================
ERROR collecting .tox/py27/tmp/testdir/test_steps_in_parametrize1/test_steps_in_parametrize.py
test_steps_in_parametrize.py:8: in pytest_generate_tests
metafunc.parametrize('val', [foo()])
../../../local/lib/python2.7/site-packages/allure/common.py:56: in impl
with StepContext(self.allure, self.title.format(*a, **kw)):
../../../local/lib/python2.7/site-packages/allure/common.py:34: in __enter__
self.step = self.allure.start_step(self.title)
../../../local/lib/python2.7/site-packages/allure/pytest_plugin.py:159: in start_step
self.stack[-1].steps.append(step)
E AttributeError: 'AllureTestListener' object has no attribute 'stack'
=========================== 1 error in 0.27 seconds ============================
That is due to fact that stack is initialized per-test and only during pytest_runtest_protocol hook invocation. Added test manifest that behaviour.
The fix proposed is super-ugly, but does the trick. I'm considering other options -- but that may serve as an intermediate solution for now.
Proper fix not discard steps information from pre-test-run period but record them and display in the report.
I've recently encountered a problem with
allure.step
-wrapped function inpytest_generate_tests
-- they fail with ugly trace likeThat is due to fact that
stack
is initialized per-test and only duringpytest_runtest_protocol
hook invocation. Added test manifest that behaviour.The fix proposed is super-ugly, but does the trick. I'm considering other options -- but that may serve as an intermediate solution for now.
Proper fix not discard steps information from pre-test-run period but record them and display in the report.