From 680ba0969ee566107d3acee8d22de2045b12be6f Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Sat, 4 Jun 2022 09:26:05 +0200 Subject: [PATCH] REALLY make sure generated test order is stable This really does what f87ac17506c9ec47c973d7942a2951a3e953c2b5 should have done and fixes the horrible bug introduced by that commit. --- tests/modules/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/modules/conftest.py b/tests/modules/conftest.py index 7b938d3f5..35a6d99a2 100644 --- a/tests/modules/conftest.py +++ b/tests/modules/conftest.py @@ -4,6 +4,7 @@ # Copyright (C) 2015-2022 Tobias Gruetzmacher import re import os +from operator import attrgetter import pytest from xdist.dsession import LoadScopeScheduling @@ -39,9 +40,8 @@ def get_test_scrapers(): def pytest_generate_tests(metafunc): if 'scraperobj' in metafunc.fixturenames: - scrapers = get_test_scrapers() - scraperids = [x.name for x in scrapers] - metafunc.parametrize('scraperobj', scrapers, ids=sorted(scraperids)) + scrapers = sorted(get_test_scrapers(), key=attrgetter('name')) + metafunc.parametrize('scraperobj', scrapers, ids=attrgetter('name')) class LoadModScheduling(LoadScopeScheduling):