Skip to content

Commit

Permalink
thinking about a test for clear_output
Browse files Browse the repository at this point in the history
  • Loading branch information
kafonek committed Dec 20, 2023
1 parent f828940 commit 02472c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ impl OutputHandler for DebugOutputHandler {
#[tokio::main]
async fn main() {
let silent = true;
let kernel = JupyterKernel::ipython(silent);
// let kernel = JupyterKernel::ipython(silent);
let kernel = JupyterKernel::deno(silent);
let client = Client::new(kernel.connection_info.clone()).await;
client.heartbeat().await;
// small sleep to make sure iopub is connected,
Expand All @@ -47,7 +48,7 @@ async fn main() {
// let action = client.kernel_info_request(handlers).await;
let code = indoc! {r#"
from IPython.display import clear_output
print("Hello, world!")
clear_output()
"#}
Expand Down
3 changes: 2 additions & 1 deletion tests/test_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async fn test_execute_request() {
}

#[tokio::test]
#[cfg(feature = "test_ipython")]
async fn test_clear_output() {
let (_kernel, client) = start_kernel().await;

Expand All @@ -88,5 +89,5 @@ async fn test_clear_output() {
let action = client.execute_request(code.to_string(), handlers).await;
action.await;
let counts = handler.counts.lock().await;
assert_eq!(counts["clear_output"], 1);
assert_eq!(counts.get("clear_output"), Some(&1));
}

0 comments on commit 02472c3

Please sign in to comment.