From 0319af78228444d01e32c82d2cdf8e6169106acd Mon Sep 17 00:00:00 2001 From: Christophe Vandeplas Date: Wed, 5 Jun 2024 10:40:14 +0200 Subject: [PATCH] doc: [tests] explain discrepancy numb_tasks and len(tasks) --- tests/test_parsers_taskinfo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_parsers_taskinfo.py b/tests/test_parsers_taskinfo.py index aea7f86..5249e00 100644 --- a/tests/test_parsers_taskinfo.py +++ b/tests/test_parsers_taskinfo.py @@ -17,7 +17,9 @@ def test_get_tasks(self): numb_tasks = result['numb_tasks'] len_tasks = len(result['tasks']) print(f"File says {numb_tasks} tasks - found {len_tasks} tasks, delta {numb_tasks - len_tasks}") - # FIXME understand why numb_tasks is (almost) always 2 (once 3) less than len(tasks). Apple bug or mine? Or hidden processes? + # a delta is not abnormal, as numb_tasks seems to be taking the count from "ps". + # "ps" always has at least two processes running (ps and psauxwww) + # Execution of taskinfo happens at another moment, so other processes may have started/stopped self.assertTrue((len_tasks > numb_tasks - 4)) for task in result['tasks']: self.assertGreater(len(task['threads']), 0)