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

setup_class time is not considered #106

Open
njzjz opened this issue Nov 12, 2024 · 0 comments
Open

setup_class time is not considered #106

njzjz opened this issue Nov 12, 2024 · 0 comments

Comments

@njzjz
Copy link

njzjz commented Nov 12, 2024

Considering a test case with setup_class:

import time

class TestA:
    @classmethod
    def setup_class(cls):
        time.sleep(6)

    def test1(self):
        time.sleep(2)

    def test2(self):
        time.sleep(3)

Run:

pytest test_a.py --store-durations

The result in .test_durations:

{
    "test_a.py::TestA::test1": 8.008305040886626,
    "test_a.py::TestA::test2": 3.003461800981313
}

Here, the setup_class time is counted in test1, but if test1 and test2 are split into different groups, setup_class in test2 matters. To minimize the time, pytest-split should group them into the same group.

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

No branches or pull requests

1 participant