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

Function test_process_core_native

tests/unit/test_main.py:616–653  ·  view source on GitHub ↗
(argument, mode)

Source from the content-addressed store, hash-verified

614 ],
615)
616def test_process_core_native(argument, mode):
617 # GIVEN
618
619 argv = ["pystack", "core", "corefile", "executable", argument]
620
621 threads = [Mock(), Mock(), Mock()]
622
623 # WHEN
624
625 with patch(
626 "pystack.__main__.get_process_threads_for_core"
627 ) as get_process_threads_mock, patch(
628 "pystack.__main__.print_thread"
629 ) as print_thread_mock, patch(
630 "sys.argv", argv
631 ), patch(
632 "pathlib.Path.exists", return_value=True
633 ), patch(
634 "pystack.__main__.CoreFileAnalyzer"
635 ), patch(
636 "pystack.__main__.is_elf", return_value=True
637 ), patch(
638 "pystack.__main__.is_gzip", return_value=False
639 ):
640 get_process_threads_mock.return_value = threads
641 main()
642
643 # THEN
644
645 get_process_threads_mock.assert_called_with(
646 Path("corefile"),
647 Path("executable"),
648 library_search_path="",
649 native_mode=mode,
650 locals=False,
651 method=StackMethod.AUTO,
652 )
653 assert print_thread_mock.mock_calls == [call(thread, mode) for thread in threads]
654
655
656def test_process_core_locals():

Callers

nothing calls this directly

Calls 1

mainFunction · 0.90

Tested by

no test coverage detected