Skip to content

Performance regression with skipped tests since pytest 8.0.0 #12608

@henriquegemignani

Description

@henriquegemignani

There's a significant CPU overhead when processing the results of a skipped test, depending on stack size when you call pytest.skip .

The following code takes 0.78s for pytest 7.4.4 and 23.93s for pytest 8.2.2

import pytest def get_data(): pytest.skip("Skipped") @pytest.fixture(scope="session") def data(): return get_data() @pytest.mark.parametrize("index", list(range(1000))) def test_do_nothing(data, index): assert index >= 0

pip list:

python -m pip list Package Version --------- ------- colorama 0.4.6 iniconfig 2.0.0 packaging 24.1 pip 24.0 pluggy 1.5.0 pytest 7.4.4 

Environment for tests: Windows 11 with Python 3.13.0b2
Bug was originally identified on GHA Linux, Python 3.10, 3.11 and 3.12, then confirmed on Windows + Python 3.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions