From 9f78a4c9dd734a50d3fdc89dfe599a688dac62a1 Mon Sep 17 00:00:00 2001 From: Acly Date: Fri, 13 Sep 2024 11:20:00 +0200 Subject: [PATCH] Optimize test order (fewer model reloads) --- tests/conftest.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index cdd40274e8..8664545d52 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,6 +21,22 @@ def pytest_addoption(parser): parser.addoption("--benchmark", action="store_true") +def pytest_collection_modifyitems(session, config, items: list[pytest.Item]): + def order(item: pytest.Item): + if not item.parent or "test_workflow" not in item.parent.name: + return 0 + if "cloud" in item.name and "sdxl" in item.name: + return 4 + elif "cloud" in item.name: + return 3 + elif "sdxl" in item.name: + return 2 + else: + return 1 + + items.sort(key=order) + + class QtTestApp: def __init__(self): self._app = QCoreApplication([])