pytest/testing/python
Ran Benita 153a436bc4 [8.2.x] fixtures: fix catastrophic performance problem in `reorder_items`
Manual minimal backport from commit e89d23b247.

Fix #12355.

In the issue, it was reported that the `reorder_items` has quadratic (or
worse...) behavior with certain simple parametrizations. After some
debugging I found that the problem happens because the "Fix
items_by_argkey order" loop keeps adding the same item to the deque,
and it reaches epic sizes which causes the slowdown.

I don't claim to understand how the `reorder_items` algorithm works, but
if as far as I understand, if an item already exists in the deque, the
correct thing to do is to move it to the front. Since a deque doesn't
have such an (efficient) operation, this switches to `OrderedDict` which
can efficiently append from both sides, deduplicate and move to front.
2024-06-04 10:33:50 +03:00
..
approx.py Fixed Bug Regarding Attribute Error in pytest.approx For Types Implicitly Convertible to Numpy Arrays (#12232) 2024-04-23 10:45:33 +02:00
collect.py [ruff] Activate use next(iter(x)) instead of list(x)[0] and fix issue 2024-02-02 15:18:38 +01:00
fixtures.py [8.2.x] fixtures: fix catastrophic performance problem in `reorder_items` 2024-06-04 10:33:50 +03:00
integration.py [8.2.x] Spelling (#12331) 2024-05-15 18:25:57 +00:00
metafunc.py [pre-commit.ci] pre-commit autoupdate (#12115) 2024-03-13 15:30:18 +02:00
raises.py [flake8-bugbear] Fixes a B017 we can actually fix and noqa the two others 2024-02-04 19:27:23 +01:00
show_fixtures_per_test.py add feature to view fixture source location in invocations with --fixtures-per-test option (#8626) 2021-05-14 14:38:55 +02:00