Pytest fixtures ordering in allure report seems random #2643
Answered
by
delatrie
toitoinou
asked this question in
Questions & Support
-
Beta Was this translation helpful? Give feedback.
Answered by
delatrie
Jul 17, 2024
Replies: 1 comment 1 reply
-
Hi, @toitoinou ! Allure Report orders fixtures by their start time, which has a precision of 1 ms. If your fixtures execute fast enough, their start time is the same resulting in a random order. It can't be fixed until some notion of order is introduced into Allure's handling of fixtures. As a workaround, you may introduce a small delay: import time
@pytest.fixture
def instanciate_mocks():
"""
Setup actions, e.g., establishing a connection
"""
mock = {"instanciate": True}
time.sleep(0.001)
yield mock
time.sleep(0.001)
mock["instanciate"] = False It's not elegant, but solves the problem. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
toitoinou
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, @toitoinou ! Allure Report orders fixtures by their start time, which has a precision of 1 ms. If your fixtures execute fast enough, their start time is the same resulting in a random order. It can't be fixed until some notion of order is introduced into Allure's handling of fixtures.
As a workaround, you may introduce a small delay:
It's not elegant, but solves the problem.