You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test collection order broken when using page fixture #304
Given a folder contains multiple test modules each of which defining a test function that references the page fixture and one parametrized variable, when calling pytest --collect-only, then the list of test cases is not in module order but shuffled at seemingly random.
The issue occurs since pytest version 8.4.0. Tested with python 3.13.7, playwright 1.56.0 and pytest-playwright 0.7.1.
See "New features" -> "#12749: pytest traditionally collects classes/functions in the test module namespace even if they are imported from another file."
Yes, I think so too. I guess it's up to the playwright plugin to adapt to the breaking changes. I opened an issue in pytest some time ago and they adviced me to open an issue here.
Fixed by #284: browser_name is now parametrized indirectly, so pytest >= 8.4 no longer re-indexes it and tests stay in module order (--collect-only keeps test_a[chromium-apple], test_a[chromium-orange], ... together). A regression test covers two modules with their own parametrization across two browsers. It will be in the next release; until then it's on main.
Activity
ltsuda commentedon Nov 18, 2025
Do you think is related to new feature from
pytest 8.4.0itself and not fromplaywright-pytest?https://github.com/pytest-dev/pytest/releases/tag/8.4.0
See "New features" -> "#12749: pytest traditionally collects classes/functions in the test module namespace even if they are imported from another file."
joniemi commentedon Nov 20, 2025
Yes, I think so too. I guess it's up to the playwright plugin to adapt to the breaking changes. I opened an issue in pytest some time ago and they adviced me to open an issue here.
test: add regression test for collection order with browser parametri…
pavelfeldman commentedon Oct 8, 2026
Fixed by #284:
browser_nameis now parametrized indirectly, so pytest >= 8.4 no longer re-indexes it and tests stay in module order (--collect-onlykeepstest_a[chromium-apple],test_a[chromium-orange], ... together). A regression test covers two modules with their own parametrization across two browsers. It will be in the next release; until then it's onmain.