From 6933d0560aa37e9cdace3a9b8adda85bd774ec6f Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Wed, 7 Feb 2024 11:35:32 -0500 Subject: [PATCH] Pytest: reenable gc in pytest fixture + re-combine jenkins car tests (#31351) * Revert "jenkins: spilt car tests in two steps (#31346)" This reverts commit 8a00b30029c80ca71a0596134d1d91db8f5b24f0. * enable gc * codespell * useless comment --- Jenkinsfile | 5 ++--- conftest.py | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 09c893268b..392253e845 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -272,9 +272,8 @@ node { 'car tests': { pcStage("car tests") { sh label: "build", script: "selfdrive/manager/build.py" - sh label: "test_models", script: "INTERNAL_SEG_CNT=300 FILEREADER_CACHE=1 INTERNAL_SEG_LIST=selfdrive/car/tests/test_models_segs.txt \ - pytest selfdrive/car/tests/test_models.py" - sh label: "test_car_interfaces", script: "MAX_EXAMPLES=300 pytest selfdrive/car/tests/test_car_interfaces.py" + sh label: "run car tests", script: "cd selfdrive/car/tests && MAX_EXAMPLES=300 INTERNAL_SEG_CNT=300 FILEREADER_CACHE=1 \ + INTERNAL_SEG_LIST=selfdrive/car/tests/test_models_segs.txt pytest test_models.py test_car_interfaces.py" } }, diff --git a/conftest.py b/conftest.py index e215bb8b4c..544025e180 100644 --- a/conftest.py +++ b/conftest.py @@ -1,3 +1,4 @@ +import gc import os import pytest import random @@ -45,6 +46,11 @@ def openpilot_function_fixture(request): # cleanup any started processes manager.manager_cleanup() + # some processes disable gc for performance, re-enable here + if not gc.isenabled(): + gc.enable() + gc.collect() + # If you use setUpClass, the environment variables won't be cleared properly, # so we need to hook both the function and class pytest fixtures @pytest.fixture(scope="class", autouse=True)