From 62d0647ab36e69edaba1d4e92c83c206701fd118 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Wed, 6 Dec 2023 16:00:59 -0800 Subject: [PATCH] pytest: group test_models by route instead of car name (#30625) * group by route * dont need those old-commit-hash: f16df8e4b7901f5e38b6f90a8900eef02faab504 --- Jenkinsfile | 4 ++-- conftest.py | 5 +++-- selfdrive/car/tests/test_models.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 446435f7fe..ec39882201 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -235,8 +235,8 @@ node { pcStage("car tests") { sh label: "build", script: "selfdrive/manager/build.py" sh label: "test_models.py", script: "INTERNAL_SEG_CNT=250 INTERNAL_SEG_LIST=selfdrive/car/tests/test_models_segs.txt FILEREADER_CACHE=1 \ - pytest -n auto --dist=loadscope selfdrive/car/tests/test_models.py" - sh label: "test_car_interfaces.py", script: "MAX_EXAMPLES=100 pytest -n auto --dist=load selfdrive/car/tests/test_car_interfaces.py" + pytest selfdrive/car/tests/test_models.py" + sh label: "test_car_interfaces.py", script: "MAX_EXAMPLES=100 pytest selfdrive/car/tests/test_car_interfaces.py" } }, diff --git a/conftest.py b/conftest.py index 9aaf04d798..d1787c24ef 100644 --- a/conftest.py +++ b/conftest.py @@ -45,8 +45,9 @@ def pytest_collection_modifyitems(config, items): item.add_marker(skipper) if "xdist_group_class_property" in item.keywords: - class_property = item.get_closest_marker('xdist_group_class_property').args[0] - item.add_marker(pytest.mark.xdist_group(getattr(item.cls, class_property))) + class_property_name = item.get_closest_marker('xdist_group_class_property').args[0] + class_property_value = getattr(item.cls, class_property_name) + item.add_marker(pytest.mark.xdist_group(class_property_value)) @pytest.hookimpl(trylast=True) diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index f26fd363ca..0ae104f9f5 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -382,7 +382,7 @@ class TestCarModelBase(unittest.TestCase): @parameterized_class(('car_model', 'test_route'), get_test_cases()) -@pytest.mark.xdist_group_class_property('car_model') +@pytest.mark.xdist_group_class_property('test_route') class TestCarModel(TestCarModelBase): pass