From 6b5d5a23362e9f276371c61b92758654e6bdc4e6 Mon Sep 17 00:00:00 2001 From: Simon Fayer Date: Thu, 4 Jun 2026 09:53:59 +0100 Subject: [PATCH] fix: Update profile test to make it more reliable --- src/DIRAC/Core/Utilities/test/Test_Profiler.py | 5 ++++- src/DIRAC/tests/Utilities/ProcessesCreator_withChildren.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/DIRAC/Core/Utilities/test/Test_Profiler.py b/src/DIRAC/Core/Utilities/test/Test_Profiler.py index 601025c7479..375a68cf958 100644 --- a/src/DIRAC/Core/Utilities/test/Test_Profiler.py +++ b/src/DIRAC/Core/Utilities/test/Test_Profiler.py @@ -76,8 +76,10 @@ def test_base(): assert resWC["Value"] >= 0 assert resWC["Value"] >= res["Value"] + mainProcess.kill() + mainProcess.wait() + -@pytest.mark.flaky(reruns=10) def test_cpuUsage(): mainProcess = Popen( [ @@ -147,6 +149,7 @@ def test_cpuUsage(): assert resTC["Value"] >= res["Value"] # After this the main process will no-longer exist + mainProcess.kill() mainProcess.wait() res = p.cpuUsageUser() diff --git a/src/DIRAC/tests/Utilities/ProcessesCreator_withChildren.py b/src/DIRAC/tests/Utilities/ProcessesCreator_withChildren.py index 015480dca84..8b78db12314 100644 --- a/src/DIRAC/tests/Utilities/ProcessesCreator_withChildren.py +++ b/src/DIRAC/tests/Utilities/ProcessesCreator_withChildren.py @@ -26,3 +26,8 @@ def do_sum(args): p.daemon = False p.start() p.join() + + # On fast machines, this can finish too quickly + # Just sleep (we've accumulated usage now) + # and the test can interrupt this with a kill + time.sleep(60)