(python, tmpdir)
| 594 | |
| 595 | @ALL_PYTHONS |
| 596 | def test_inlined_python_calls(python, tmpdir): |
| 597 | # GIVEN |
| 598 | |
| 599 | (major_version, minor_version), python_executable = python |
| 600 | |
| 601 | # WHEN |
| 602 | |
| 603 | with spawn_child_process( |
| 604 | python_executable, TEST_INLINE_CALLS_FILE, tmpdir |
| 605 | ) as child_process: |
| 606 | threads = list(get_process_threads(child_process.pid)) |
| 607 | |
| 608 | # THEN |
| 609 | |
| 610 | assert len(threads) == 1 |
| 611 | (thread,) = threads |
| 612 | |
| 613 | frames = list(thread.frames) |
| 614 | assert (len(frames)) == 6 |
| 615 | |
| 616 | filenames = {frame.code.filename for frame in frames} |
| 617 | assert filenames == {str(TEST_INLINE_CALLS_FILE)} |
| 618 | |
| 619 | functions = [frame.code.scope for frame in frames] |
| 620 | assert functions == ["<module>", "ham", "spam", "foo", "bar", "baz"] |
| 621 | |
| 622 | if python_has_inlined_eval_frames(major_version, minor_version): # pragma: no cover |
| 623 | module, ham, spam, foo, bar, baz = frames |
| 624 | assert module.is_entry |
| 625 | assert not ham.is_entry |
| 626 | assert not spam.is_entry |
| 627 | assert foo.is_entry |
| 628 | assert not bar.is_entry |
| 629 | assert not baz.is_entry |
| 630 | else: # pragma: no cover |
| 631 | assert all(frame.is_entry for frame in frames) |
| 632 | |
| 633 | |
| 634 | @ALL_PYTHONS |
nothing calls this directly
no test coverage detected