Skip to content

Pytest fixtures ordering in allure report seems random #2643

Discussion options

You must be logged in to vote

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.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@toitoinou
Comment options

Answer selected by toitoinou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants