[FIX] base: test profiling

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) <xdo@odoo.com>
This commit is contained in:
Xavier-Do
2024-04-23 17:09:50 +00:00
parent 4d3cd6c912
commit 4eaea4c374
+1 -3
View File
@@ -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