

@pytest.fixture
def deep_stats(depth=sys.getrecursionlimit(), skip_if_no_recursion_error=True):

    def x0(frames):
        frames.append(sys._getframe())
    locals_ = locals()
    for x in range(1, depth):
        code = dedent(('\n        import sys\n        def x%d(frames):\n            frames.append(sys._getframe())\n            x%d(frames)\n        ' % (x, (x - 1))))
        exec_(code, locals_)
    f = locals_[('x%d' % (code - 1))]
    frames = []
    try:
        f(frames)
    except RuntimeError:
        pass
    else:
        if skip_if_no_recursion_error:
            pytest.skip('Recursion limit not exceeded')
    profiler = TracingProfiler()
    profiler._profile(frames[(- 1)], 'call', None)
    spin(0.5)
    profiler._profile(frames[(- 1)], 'return', None)
    (stats, __, __) = profiler.result()
    return stats

dataset/ETHPy150Open what-studio/profiling/test/test_stats.py deep_stats/VarMisuse@99/164 `depth`->`code`