Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4 shows all durations as 0ms #739

Closed
jeroenbrouwer opened this issue Sep 18, 2023 · 4 comments · Fixed by #753
Closed

Version 4 shows all durations as 0ms #739

jeroenbrouwer opened this issue Sep 18, 2023 · 4 comments · Fixed by #753

Comments

@jeroenbrouwer
Copy link

All test durations in the html report show as 0ms whereas this used to give accurate results of the test durations.

Screenshot 2023-09-18 at 12 44 41

@BeyondEvil
Copy link
Contributor

Looks like something indeed is off. 🤔

81 tests in 2 minutes and 35 seconds should give an average of about 1,2 seconds per test.

Thanks for reporting!

@BeyondEvil
Copy link
Contributor

I'm unsuccessful in repro:ing this.

def test_duration():
    sleep(0.5)
    assert True
Screenshot 2023-09-19 at 11 11 34

Can you provide a minimal reproducible code sample?

@jeroenbrouwer
Copy link
Author

jeroenbrouwer commented Sep 20, 2023

This happens when the tests use a fixture, it used to be the case that the execution of the fixture was included in the test timing.

from time import sleep
import pytest


@pytest.fixture()
def has_slept():
    sleep(2)
    return True


def test_sleep(has_slept):
    assert has_slept

Results for version 4
image

Results for version 3
image

@BeyondEvil
Copy link
Contributor

Ah, I see. Thanks for clarifying!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants