From 4eaea4c374959bfe44fb92e538ab5d4d26cf8f90 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Tue, 23 Apr 2024 16:38:10 +0200 Subject: [PATCH] [FIX] base: test profiling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test can sometimes fail randomly FAIL: TestProfiling.test_sync_recorder Traceback (most recent call last): File "/data/build/odoo/odoo/addons/base/tests/test_profiler.py", line 440, in test_sync_recorder self.assertEqual(stacks_methods, [ AssertionError: Lists differ: [['a'[114 chars]], ['__exit__', '_remove'], ['__exit__'], ['__exit__', 'stop']] != [['a'[114 chars]], ['__exit__', 'stop']] First differing element 11: ['__exit__', '_remove'] ['__exit__', 'stop'] First list contains 2 additional elements. First extra element 12: ['__exit__'] [['a'], ['a', 'b'], ['a'], ['a', 'c'], ['a', 'c', 'd'], ['a', 'c'], ['a', 'c', 'd'], ['a', 'c'], ['a'], [], ['__exit__'], - ['__exit__', '_remove'], - ['__exit__'], ['__exit__', 'stop']] Since we don't care about the last lines, just remove them from the assertion. closes odoo/odoo#163016 Signed-off-by: Xavier Dollé (xdo) --- odoo/addons/base/tests/test_profiler.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/odoo/addons/base/tests/test_profiler.py b/odoo/addons/base/tests/test_profiler.py index fc5207fa453..f04c8e40101 100644 --- a/odoo/addons/base/tests/test_profiler.py +++ b/odoo/addons/base/tests/test_profiler.py @@ -437,7 +437,7 @@ class TestProfiling(TransactionCase): # map stack frames to their function name, and check stacks_methods = [[frame[2] for frame in stack] for stack in stacks] - self.assertEqual(stacks_methods, [ + self.assertEqual(stacks_methods[:-2], [ ['a'], ['a', 'b'], ['a'], @@ -448,8 +448,6 @@ class TestProfiling(TransactionCase): ['a', 'c'], ['a'], [], - ['__exit__'], - ['__exit__', 'stop'] # could be removed by cleaning two last frames, or removing last frames only contained in profiler.py ]) # map stack frames to their line number, and check