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

Function test_process_remote_error

tests/unit/test_main.py:382–408  ·  view source on GitHub ↗
(exception, exval, capsys)

Source from the content-addressed store, hash-verified

380 "exception, exval", [(EngineError, 1), (InvalidPythonProcess, 2)]
381)
382def test_process_remote_error(exception, exval, capsys):
383 # GIVEN
384
385 argv = ["pystack", "remote", "32"]
386
387 # WHEN
388
389 with patch(
390 "pystack.__main__.get_process_threads"
391 ) as get_process_threads_mock, patch(
392 "pystack.__main__.print_thread"
393 ) as print_thread_mock, patch(
394 "sys.argv", argv
395 ), patch(
396 "pathlib.Path.exists", return_value=True
397 ):
398 get_process_threads_mock.side_effect = exception("Oh no!")
399 with pytest.raises(SystemExit) as excinfo:
400 main()
401 assert excinfo.value.code == exval
402
403 # THEN
404
405 get_process_threads_mock.assert_called_once()
406 print_thread_mock.assert_not_called()
407 capture = capsys.readouterr()
408 assert "Oh no!" in capture.err
409
410
411def test_process_core_default_without_executable():

Callers

nothing calls this directly

Calls 1

mainFunction · 0.90

Tested by

no test coverage detected