MCPcopy Create free account
hub / github.com/bloomberg/pystack / test_inlined_python_calls

Function test_inlined_python_calls

tests/integration/test_core_analyzer.py:404–439  ·  view source on GitHub ↗
(python, tmpdir)

Source from the content-addressed store, hash-verified

402
403@ALL_PYTHONS
404def test_inlined_python_calls(python, tmpdir):
405 # GIVEN
406
407 (major_version, minor_version), python_executable = python
408
409 # WHEN
410
411 with generate_core_file(
412 python_executable, TEST_INLINE_CALLS_FILE, tmpdir
413 ) as core_file:
414 threads = list(get_process_threads_for_core(core_file, python_executable))
415
416 # THEN
417
418 assert len(threads) == 1
419 (thread,) = threads
420
421 frames = list(thread.frames)
422 assert (len(frames)) == 6
423
424 filenames = {frame.code.filename for frame in frames}
425 assert filenames == {str(TEST_INLINE_CALLS_FILE)}
426
427 functions = [frame.code.scope for frame in frames]
428 assert functions == ["<module>", "ham", "spam", "foo", "bar", "baz"]
429
430 if python_has_inlined_eval_frames(major_version, minor_version): # pragma: no cover
431 module, ham, spam, foo, bar, baz = frames
432 assert module.is_entry
433 assert not ham.is_entry
434 assert not spam.is_entry
435 assert foo.is_entry
436 assert not bar.is_entry
437 assert not baz.is_entry
438 else: # pragma: no cover
439 assert all(frame.is_entry for frame in frames)
440
441
442@ALL_PYTHONS

Callers

nothing calls this directly

Calls 2

generate_core_fileFunction · 0.90

Tested by

no test coverage detected