-
Notifications
You must be signed in to change notification settings - Fork 23
Take charge of parsing and evaluating inputs #960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c93bf69
5df36e9
7dd0f4e
2f07846
0650040
3367930
dccf144
fc697b7
2040e08
4bae770
019cba0
7c3c168
69ca0dc
cad9a3f
e884469
e6ec6e4
acf96e4
30d244b
fde428e
13f1fd0
666a727
fb69d6b
02a8aa4
acf7965
22e21bb
6bb6f3b
94229c6
8810197
83ba148
5780f6d
d257e05
3ec41cb
5e219c2
6216051
ab9a936
cf63dbc
42f8775
6d2f1e8
492d33c
337efde
b4839c2
a4272d1
0b9052c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ use amalthea::wire::comm_info_request::CommInfoRequest; | |
| use amalthea::wire::comm_msg::CommWireMsg; | ||
| use amalthea::wire::comm_open::CommOpen; | ||
| use amalthea::wire::jupyter_message::Message; | ||
| use amalthea::wire::jupyter_message::Status; | ||
| use amalthea::wire::kernel_info_request::KernelInfoRequest; | ||
| use amalthea::wire::status::ExecutionState; | ||
| use assert_matches::assert_matches; | ||
|
|
@@ -63,6 +64,34 @@ fn test_amalthea_execute_request() { | |
| frontend.recv_iopub_idle(); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_amalthea_shutdown_request() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems weird that this test can send a shutdown request twice. But is the argument that it isn't connected to an R backend that actually does something with the shutdown request? |
||
| let frontend = DummyAmaltheaFrontend::lock(); | ||
|
|
||
| // Send a shutdown request with restart = false | ||
| frontend.send_shutdown_request(false); | ||
|
|
||
| // Shutdown requests generate busy/idle status messages on IOPub | ||
| frontend.recv_iopub_busy(); | ||
|
|
||
| // Receive the shutdown reply | ||
| let reply = frontend.recv_control_shutdown_reply(); | ||
| assert_eq!(reply.status, Status::Ok); | ||
| assert_eq!(reply.restart, false); | ||
|
|
||
| frontend.recv_iopub_idle(); | ||
|
|
||
| // Test with restart = true | ||
|
Comment on lines
+71
to
+84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think these comments add much |
||
| frontend.send_shutdown_request(true); | ||
| frontend.recv_iopub_busy(); | ||
|
|
||
| let reply = frontend.recv_control_shutdown_reply(); | ||
| assert_eq!(reply.status, Status::Ok); | ||
| assert_eq!(reply.restart, true); | ||
|
|
||
| frontend.recv_iopub_idle(); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_amalthea_input_request() { | ||
| let frontend = DummyAmaltheaFrontend::lock(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,7 +141,7 @@ impl RMainDap { | |
| self.debugging = false; | ||
| } | ||
|
|
||
| pub fn handle_stdout(&mut self, content: &str) { | ||
| pub fn handle_write_console(&mut self, content: &str) { | ||
| if let DebugCallText::Capturing(ref mut call_text) = self.call_text { | ||
| // Append to current expression if we are currently capturing stdout | ||
| call_text.push_str(content); | ||
|
|
@@ -164,7 +164,11 @@ impl RMainDap { | |
| } | ||
| } | ||
|
|
||
| pub fn finalize_call_text(&mut self) { | ||
| pub fn handle_read_console(&mut self) { | ||
| // Upon entering read-console, finalize any debug call text that we were capturing. | ||
| // At this point, the user can either advance the debugger, causing us to capture | ||
| // a new expression, or execute arbitrary code, where we will reuse a finalized | ||
| // debug call text to maintain the debug state. | ||
| match &self.call_text { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we had discussed maybe moving |
||
| // If not debugging, nothing to do. | ||
| DebugCallText::None => (), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure it does mandate status messages for Control
https://jupyter-client.readthedocs.io/en/latest/messaging.html#status
If you agree, I think we should remove or tweak this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based my comment on this quote.
"not just execution" could just refer to other types of Shell requests, including comm messages. Note that this section is incomplete and does not say anything about the parent header of the status messages, so an implementer might create inadvertently non-nested shell status messages.
I think wrapping control requests in Busy/Idle is a strange choice that unnecessarily complicates the protocol.