From 21fe2710afcb11b5dfe362c672dd330d23439d9a Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Mon, 3 Jul 2023 16:29:37 +0200 Subject: [PATCH 1/5] Implementation of jep #65 --- include/xeus-zmq/xserver_zmq.hpp | 10 +++-- include/xeus-zmq/xserver_zmq_split.hpp | 9 +++-- include/xeus-zmq/xzmq_serializer.hpp | 2 + src/xpublisher.cpp | 52 +++++++++++++++++++++++--- src/xpublisher.hpp | 10 +++++ src/xserver_zmq.cpp | 13 ++++++- src/xserver_zmq_split.cpp | 14 ++++++- src/xzmq_serializer.cpp | 10 +++++ 8 files changed, 105 insertions(+), 15 deletions(-) diff --git a/include/xeus-zmq/xserver_zmq.hpp b/include/xeus-zmq/xserver_zmq.hpp index e8238ec..d28df94 100644 --- a/include/xeus-zmq/xserver_zmq.hpp +++ b/include/xeus-zmq/xserver_zmq.hpp @@ -11,17 +11,18 @@ #define XEUS_SERVER_IMPL_HPP #include "zmq.hpp" +#include "zmq_addon.hpp" #include "xeus/xeus_context.hpp" #include "xeus/xkernel_configuration.hpp" #include "xeus/xserver.hpp" #include "xeus-zmq.hpp" -#include "xauthentication.hpp" #include "xthread.hpp" namespace xeus { + class xauthentication; class xpublisher; class xheartbeat; class xtrivial_messenger; @@ -39,6 +40,8 @@ namespace xeus ~xserver_zmq() override; + zmq::multipart_t create_iopub_welcome_wire_msg(const std::string& topic); + using xserver::notify_internal_listener; protected: @@ -67,6 +70,9 @@ namespace xeus zmq::socket_t m_publisher_controller; zmq::socket_t m_heartbeat_controller; + using authentication_ptr = std::unique_ptr; + authentication_ptr p_auth; + publisher_ptr p_publisher; heartbeat_ptr p_heartbeat; @@ -76,8 +82,6 @@ namespace xeus using trivial_messenger_ptr = std::unique_ptr; trivial_messenger_ptr p_messenger; - using authentication_ptr = std::unique_ptr; - authentication_ptr p_auth; nl::json::error_handler_t m_error_handler; bool m_request_stop; diff --git a/include/xeus-zmq/xserver_zmq_split.hpp b/include/xeus-zmq/xserver_zmq_split.hpp index 1e53713..6cd7f8d 100644 --- a/include/xeus-zmq/xserver_zmq_split.hpp +++ b/include/xeus-zmq/xserver_zmq_split.hpp @@ -18,11 +18,11 @@ #include "xeus/xkernel_configuration.hpp" #include "xeus-zmq.hpp" -#include "xauthentication.hpp" #include "xthread.hpp" namespace xeus { + class xauthentication; class xcontrol; class xheartbeat; class xpublisher; @@ -54,6 +54,8 @@ namespace xeus xmessage deserialize(zmq::multipart_t& wire_msg) const; + zmq::multipart_t create_iopub_welcome_wire_msg(const std::string& topic); + protected: xcontrol_messenger& get_control_messenger_impl() override; @@ -82,6 +84,9 @@ namespace xeus virtual void start_server(zmq::multipart_t& wire_msg) = 0; + using authentication_ptr = std::unique_ptr; + authentication_ptr p_auth; + controller_ptr p_controller; heartbeat_ptr p_heartbeat; publisher_ptr p_publisher; @@ -92,8 +97,6 @@ namespace xeus xthread m_iopub_thread; xthread m_shell_thread; - using authentication_ptr = std::unique_ptr; - authentication_ptr p_auth; nl::json::error_handler_t m_error_handler; std::atomic m_control_stopped; diff --git a/include/xeus-zmq/xzmq_serializer.hpp b/include/xeus-zmq/xzmq_serializer.hpp index 089dc33..fa7f3f7 100644 --- a/include/xeus-zmq/xzmq_serializer.hpp +++ b/include/xeus-zmq/xzmq_serializer.hpp @@ -36,6 +36,8 @@ namespace xeus static xpub_message deserialize_iopub(zmq::multipart_t& wire_msg, const xauthentication& auth); + + static xpub_message create_xpub_message(const std::string& topic); }; } diff --git a/src/xpublisher.cpp b/src/xpublisher.cpp index 87d10be..43756c3 100644 --- a/src/xpublisher.cpp +++ b/src/xpublisher.cpp @@ -7,10 +7,9 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#include #include +#include -#include "zmq_addon.hpp" #include "xeus-zmq/xmiddleware.hpp" #include "xpublisher.hpp" @@ -20,11 +19,13 @@ namespace xeus const std::string& transport, const std::string& ip, const std::string& port) - : m_publisher(context, zmq::socket_type::pub) + : m_publisher(context, zmq::socket_type::xpub) , m_listener(context, zmq::socket_type::sub) , m_controller(context, zmq::socket_type::rep) { init_socket(m_publisher, transport, ip, port); + // Set xpub_verbose option to 1 to pass all subscription messages (not only unique ones). + m_publisher.set(zmq::sockopt::xpub_verbose, 1); m_listener.set(zmq::sockopt::subscribe, ""); m_listener.bind(get_publisher_end_point()); m_controller.set(zmq::sockopt::linger, get_socket_linger()); @@ -44,12 +45,13 @@ namespace xeus { zmq::pollitem_t items[] = { { m_listener, 0, ZMQ_POLLIN, 0 }, - { m_controller, 0, ZMQ_POLLIN, 0 } + { m_controller, 0, ZMQ_POLLIN, 0 }, + { m_publisher, 0, ZMQ_POLLIN, 0 } }; while (true) { - zmq::poll(&items[0], 2, std::chrono::milliseconds(-1)); + zmq::poll(&items[0], 3, std::chrono::milliseconds(-1)); if (items[0].revents & ZMQ_POLLIN) { @@ -66,6 +68,46 @@ namespace xeus wire_msg.send(m_controller); break; } + + if (items[2].revents & ZMQ_POLLIN) + { + // Received event: Single frame + // Either `1{subscription-topic}` for subscription + // or `0{subscription-topic}` for unsubscription + zmq::multipart_t wire_msg; + wire_msg.recv(m_publisher); + + // Received event should be a single frame + if (wire_msg.size() != 1) + { + throw std::runtime_error("ERROR: Received message on XPUB is not a single frame"); + } + + zmq::message_t frame = wire_msg.pop(); + if (frame.size() == 0) + { + break; + } + + // Event is one byte 0 = unsub or 1 = sub, followed by topic + uint8_t *event = (uint8_t *)frame.data(); + // If subscription (unsubscription is ignored) + if (event[0] == 1) + { + std::string topic((char *)(event + 1), frame.size() - 1); + if (m_serialize_iopub_msg_cb) + { + // Construct the `iopub_welcome` message + zmq::multipart_t iopub_welcome_wire_msg = m_serialize_iopub_msg_cb(topic); + // Send the `iopub_welcome` message + iopub_welcome_wire_msg.send(m_publisher); + } + else + { + throw std::runtime_error("ERROR: IOPUB serialization callback not set"); + } + } + } } } } diff --git a/src/xpublisher.hpp b/src/xpublisher.hpp index ba59d30..bf6e4ea 100644 --- a/src/xpublisher.hpp +++ b/src/xpublisher.hpp @@ -10,9 +10,11 @@ #ifndef XEUS_PUBLISHER_HPP #define XEUS_PUBLISHER_HPP +#include #include #include "zmq.hpp" +#include "zmq_addon.hpp" namespace xeus { @@ -29,6 +31,12 @@ namespace xeus std::string get_port() const; + template + inline void set_iopub_cb(zmq::multipart_t(C::*cb)(const std::string&), C* data) + { + m_serialize_iopub_msg_cb = std::bind(cb, data, std::placeholders::_1); + } + void run(); private: @@ -36,6 +44,8 @@ namespace xeus zmq::socket_t m_publisher; zmq::socket_t m_listener; zmq::socket_t m_controller; + + std::function m_serialize_iopub_msg_cb; }; } diff --git a/src/xserver_zmq.cpp b/src/xserver_zmq.cpp index 9c4e8b6..cf5b3c7 100644 --- a/src/xserver_zmq.cpp +++ b/src/xserver_zmq.cpp @@ -10,8 +10,8 @@ #include #include -#include "zmq_addon.hpp" #include "xeus/xguid.hpp" +#include "xeus-zmq/xauthentication.hpp" #include "xeus-zmq/xserver_zmq.hpp" #include "xeus-zmq/xmiddleware.hpp" #include "xeus-zmq/xzmq_serializer.hpp" @@ -31,15 +31,16 @@ namespace xeus , m_publisher_pub(context, zmq::socket_type::pub) , m_publisher_controller(context, zmq::socket_type::req) , m_heartbeat_controller(context, zmq::socket_type::req) + , p_auth(make_xauthentication(config.m_signature_scheme, config.m_key)) , p_publisher(new xpublisher(context, config.m_transport, config.m_ip, config.m_iopub_port)) , p_heartbeat(new xheartbeat(context, config.m_transport, config.m_ip, config.m_hb_port)) , m_iopub_thread() , m_hb_thread() , p_messenger(new xtrivial_messenger(this)) - , p_auth(make_xauthentication(config.m_signature_scheme, config.m_key)) , m_error_handler(eh) , m_request_stop(false) { + p_publisher->set_iopub_cb(&xserver_zmq::create_iopub_welcome_wire_msg, this); init_socket(m_shell, config.m_transport, config.m_ip, config.m_shell_port); init_socket(m_controller, config.m_transport, config.m_ip, config.m_control_port); init_socket(m_stdin, config.m_transport, config.m_ip, config.m_stdin_port); @@ -207,6 +208,14 @@ namespace xeus (void)m_heartbeat_controller.recv(response); } + zmq::multipart_t xserver_zmq::create_iopub_welcome_wire_msg(const std::string& topic) + { + // Create the `iopub_welcome` wire message + xpub_message p_msg = xzmq_serializer::create_xpub_message(topic); + zmq::multipart_t wire_msg = xzmq_serializer::serialize_iopub(std::move(p_msg), *p_auth, m_error_handler); + return wire_msg; + } + std::unique_ptr make_xserver_zmq(xcontext& context, const xconfiguration& config, nl::json::error_handler_t eh) diff --git a/src/xserver_zmq_split.cpp b/src/xserver_zmq_split.cpp index 824a6d2..5944b73 100644 --- a/src/xserver_zmq_split.cpp +++ b/src/xserver_zmq_split.cpp @@ -12,6 +12,7 @@ #include "zmq_addon.hpp" #include "xeus/xguid.hpp" +#include "xeus-zmq/xauthentication.hpp" #include "xeus-zmq/xserver_zmq_split.hpp" #include "xeus-zmq/xmiddleware.hpp" #include "xeus-zmq/xzmq_serializer.hpp" @@ -26,7 +27,8 @@ namespace xeus xserver_zmq_split::xserver_zmq_split(zmq::context_t& context, const xconfiguration& config, nl::json::error_handler_t eh) - : p_controller(new xcontrol(context, config.m_transport, config.m_ip ,config.m_control_port, this)) + : p_auth(make_xauthentication(config.m_signature_scheme, config.m_key)) + , p_controller(new xcontrol(context, config.m_transport, config.m_ip ,config.m_control_port, this)) , p_heartbeat(new xheartbeat(context, config.m_transport, config.m_ip, config.m_hb_port)) , p_publisher(new xpublisher(context, config.m_transport, config.m_ip, config.m_iopub_port)) , p_shell(new xshell(context, config.m_transport, config.m_ip ,config.m_shell_port, config.m_stdin_port, this)) @@ -34,10 +36,10 @@ namespace xeus , m_hb_thread() , m_iopub_thread() , m_shell_thread() - , p_auth(make_xauthentication(config.m_signature_scheme, config.m_key)) , m_error_handler(eh) , m_control_stopped(false) { + p_publisher->set_iopub_cb(&xserver_zmq_split::create_iopub_welcome_wire_msg, this); p_controller->connect_messenger(); } @@ -157,5 +159,13 @@ namespace xeus { return m_control_stopped; } + + zmq::multipart_t xserver_zmq_split::create_iopub_welcome_wire_msg(const std::string& topic) + { + // Create the `iopub_welcome` wire message + xpub_message p_msg = xzmq_serializer::create_xpub_message(topic); + zmq::multipart_t wire_msg = xzmq_serializer::serialize_iopub(std::move(p_msg), *p_auth, m_error_handler); + return wire_msg; + } } diff --git a/src/xzmq_serializer.cpp b/src/xzmq_serializer.cpp index ad16e85..1efadad 100644 --- a/src/xzmq_serializer.cpp +++ b/src/xzmq_serializer.cpp @@ -187,5 +187,15 @@ namespace xeus xmessage_base_data data = deserialize_message_base(wire_msg, auth); return xpub_message(topic, std::move(data)); } + + xpub_message xzmq_serializer::create_xpub_message(const std::string& topic) + { + xmessage_base_data data; + data.m_header = xeus::make_header("iopub_welcome", "", ""); + data.m_content["subscription"] = topic; + xpub_message p_msg("", std::move(data)); + + return p_msg; + } } From 801ce6960ff148d3b39b35738c7157b75cbaddbb Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Tue, 11 Jul 2023 17:22:27 +0200 Subject: [PATCH 2/5] Code review: Modifying some functions locations, names and use --- include/xeus-zmq/xserver_zmq.hpp | 2 +- include/xeus-zmq/xserver_zmq_split.hpp | 2 +- include/xeus-zmq/xzmq_serializer.hpp | 2 -- src/xpublisher.cpp | 19 ++++++++++++++----- src/xpublisher.hpp | 13 ++++++------- src/xserver_zmq.cpp | 12 +++++------- src/xserver_zmq_split.cpp | 12 +++++------- src/xzmq_serializer.cpp | 10 ---------- 8 files changed, 32 insertions(+), 40 deletions(-) diff --git a/include/xeus-zmq/xserver_zmq.hpp b/include/xeus-zmq/xserver_zmq.hpp index d28df94..220b290 100644 --- a/include/xeus-zmq/xserver_zmq.hpp +++ b/include/xeus-zmq/xserver_zmq.hpp @@ -40,7 +40,7 @@ namespace xeus ~xserver_zmq() override; - zmq::multipart_t create_iopub_welcome_wire_msg(const std::string& topic); + zmq::multipart_t serialize_iopub(xpub_message&& msg); using xserver::notify_internal_listener; diff --git a/include/xeus-zmq/xserver_zmq_split.hpp b/include/xeus-zmq/xserver_zmq_split.hpp index 6cd7f8d..c851184 100644 --- a/include/xeus-zmq/xserver_zmq_split.hpp +++ b/include/xeus-zmq/xserver_zmq_split.hpp @@ -54,7 +54,7 @@ namespace xeus xmessage deserialize(zmq::multipart_t& wire_msg) const; - zmq::multipart_t create_iopub_welcome_wire_msg(const std::string& topic); + zmq::multipart_t serialize_iopub(xpub_message&& msg); protected: diff --git a/include/xeus-zmq/xzmq_serializer.hpp b/include/xeus-zmq/xzmq_serializer.hpp index fa7f3f7..089dc33 100644 --- a/include/xeus-zmq/xzmq_serializer.hpp +++ b/include/xeus-zmq/xzmq_serializer.hpp @@ -36,8 +36,6 @@ namespace xeus static xpub_message deserialize_iopub(zmq::multipart_t& wire_msg, const xauthentication& auth); - - static xpub_message create_xpub_message(const std::string& topic); }; } diff --git a/src/xpublisher.cpp b/src/xpublisher.cpp index 43756c3..7593e38 100644 --- a/src/xpublisher.cpp +++ b/src/xpublisher.cpp @@ -16,12 +16,14 @@ namespace xeus { xpublisher::xpublisher(zmq::context_t& context, + std::function serialize_iopub_msg_cb, const std::string& transport, const std::string& ip, const std::string& port) : m_publisher(context, zmq::socket_type::xpub) , m_listener(context, zmq::socket_type::sub) , m_controller(context, zmq::socket_type::rep) + , m_serialize_iopub_msg_cb(std::move(serialize_iopub_msg_cb)) { init_socket(m_publisher, transport, ip, port); // Set xpub_verbose option to 1 to pass all subscription messages (not only unique ones). @@ -36,6 +38,16 @@ namespace xeus { } + xpub_message xpublisher::create_xpub_message(const std::string& topic) + { + xmessage_base_data data; + data.m_header = xeus::make_header("iopub_welcome", "", ""); + data.m_content["subscription"] = topic; + xpub_message p_msg("", std::move(data)); + + return p_msg; + } + std::string xpublisher::get_port() const { return get_socket_port(m_publisher); @@ -84,10 +96,6 @@ namespace xeus } zmq::message_t frame = wire_msg.pop(); - if (frame.size() == 0) - { - break; - } // Event is one byte 0 = unsub or 1 = sub, followed by topic uint8_t *event = (uint8_t *)frame.data(); @@ -98,7 +106,8 @@ namespace xeus if (m_serialize_iopub_msg_cb) { // Construct the `iopub_welcome` message - zmq::multipart_t iopub_welcome_wire_msg = m_serialize_iopub_msg_cb(topic); + xpub_message p_msg = create_xpub_message(topic); + zmq::multipart_t iopub_welcome_wire_msg = m_serialize_iopub_msg_cb(std::move(p_msg)); // Send the `iopub_welcome` message iopub_welcome_wire_msg.send(m_publisher); } diff --git a/src/xpublisher.hpp b/src/xpublisher.hpp index bf6e4ea..7a54203 100644 --- a/src/xpublisher.hpp +++ b/src/xpublisher.hpp @@ -16,6 +16,8 @@ #include "zmq.hpp" #include "zmq_addon.hpp" +#include "xeus/xmessage.hpp" + namespace xeus { class xpublisher @@ -23,6 +25,7 @@ namespace xeus public: xpublisher(zmq::context_t& context, + std::function serialize_iopub_msg_cb, const std::string& transport, const std::string& ip, const std::string& port); @@ -31,21 +34,17 @@ namespace xeus std::string get_port() const; - template - inline void set_iopub_cb(zmq::multipart_t(C::*cb)(const std::string&), C* data) - { - m_serialize_iopub_msg_cb = std::bind(cb, data, std::placeholders::_1); - } - void run(); private: + xpub_message create_xpub_message(const std::string& topic); + zmq::socket_t m_publisher; zmq::socket_t m_listener; zmq::socket_t m_controller; - std::function m_serialize_iopub_msg_cb; + std::function m_serialize_iopub_msg_cb; }; } diff --git a/src/xserver_zmq.cpp b/src/xserver_zmq.cpp index cf5b3c7..0521ba2 100644 --- a/src/xserver_zmq.cpp +++ b/src/xserver_zmq.cpp @@ -32,7 +32,9 @@ namespace xeus , m_publisher_controller(context, zmq::socket_type::req) , m_heartbeat_controller(context, zmq::socket_type::req) , p_auth(make_xauthentication(config.m_signature_scheme, config.m_key)) - , p_publisher(new xpublisher(context, config.m_transport, config.m_ip, config.m_iopub_port)) + , p_publisher(new xpublisher(context, + std::bind(&xserver_zmq::serialize_iopub, this, std::placeholders::_1), + config.m_transport, config.m_ip, config.m_iopub_port)) , p_heartbeat(new xheartbeat(context, config.m_transport, config.m_ip, config.m_hb_port)) , m_iopub_thread() , m_hb_thread() @@ -40,7 +42,6 @@ namespace xeus , m_error_handler(eh) , m_request_stop(false) { - p_publisher->set_iopub_cb(&xserver_zmq::create_iopub_welcome_wire_msg, this); init_socket(m_shell, config.m_transport, config.m_ip, config.m_shell_port); init_socket(m_controller, config.m_transport, config.m_ip, config.m_control_port); init_socket(m_stdin, config.m_transport, config.m_ip, config.m_stdin_port); @@ -208,12 +209,9 @@ namespace xeus (void)m_heartbeat_controller.recv(response); } - zmq::multipart_t xserver_zmq::create_iopub_welcome_wire_msg(const std::string& topic) + zmq::multipart_t xserver_zmq::serialize_iopub(xpub_message&& msg) { - // Create the `iopub_welcome` wire message - xpub_message p_msg = xzmq_serializer::create_xpub_message(topic); - zmq::multipart_t wire_msg = xzmq_serializer::serialize_iopub(std::move(p_msg), *p_auth, m_error_handler); - return wire_msg; + return xzmq_serializer::serialize_iopub(std::move(msg), *p_auth, m_error_handler); } std::unique_ptr make_xserver_zmq(xcontext& context, diff --git a/src/xserver_zmq_split.cpp b/src/xserver_zmq_split.cpp index 5944b73..4267da4 100644 --- a/src/xserver_zmq_split.cpp +++ b/src/xserver_zmq_split.cpp @@ -30,7 +30,9 @@ namespace xeus : p_auth(make_xauthentication(config.m_signature_scheme, config.m_key)) , p_controller(new xcontrol(context, config.m_transport, config.m_ip ,config.m_control_port, this)) , p_heartbeat(new xheartbeat(context, config.m_transport, config.m_ip, config.m_hb_port)) - , p_publisher(new xpublisher(context, config.m_transport, config.m_ip, config.m_iopub_port)) + , p_publisher(new xpublisher(context, + std::bind(&xserver_zmq_split::serialize_iopub, this, std::placeholders::_1), + config.m_transport, config.m_ip, config.m_iopub_port)) , p_shell(new xshell(context, config.m_transport, config.m_ip ,config.m_shell_port, config.m_stdin_port, this)) , m_control_thread() , m_hb_thread() @@ -39,7 +41,6 @@ namespace xeus , m_error_handler(eh) , m_control_stopped(false) { - p_publisher->set_iopub_cb(&xserver_zmq_split::create_iopub_welcome_wire_msg, this); p_controller->connect_messenger(); } @@ -160,12 +161,9 @@ namespace xeus return m_control_stopped; } - zmq::multipart_t xserver_zmq_split::create_iopub_welcome_wire_msg(const std::string& topic) + zmq::multipart_t xserver_zmq_split::serialize_iopub(xpub_message&& msg) { - // Create the `iopub_welcome` wire message - xpub_message p_msg = xzmq_serializer::create_xpub_message(topic); - zmq::multipart_t wire_msg = xzmq_serializer::serialize_iopub(std::move(p_msg), *p_auth, m_error_handler); - return wire_msg; + return xzmq_serializer::serialize_iopub(std::move(msg), *p_auth, m_error_handler); } } diff --git a/src/xzmq_serializer.cpp b/src/xzmq_serializer.cpp index 1efadad..ad16e85 100644 --- a/src/xzmq_serializer.cpp +++ b/src/xzmq_serializer.cpp @@ -187,15 +187,5 @@ namespace xeus xmessage_base_data data = deserialize_message_base(wire_msg, auth); return xpub_message(topic, std::move(data)); } - - xpub_message xzmq_serializer::create_xpub_message(const std::string& topic) - { - xmessage_base_data data; - data.m_header = xeus::make_header("iopub_welcome", "", ""); - data.m_content["subscription"] = topic; - xpub_message p_msg("", std::move(data)); - - return p_msg; - } } From 0ae354a8a2cb16a25b2fd6b2905bc24ff9ef278c Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Tue, 11 Jul 2023 17:59:01 +0200 Subject: [PATCH 3/5] Add IopubWelcomeTests --- test/test_kernel.py | 3 +++ test/test_kernel_control.py | 3 +++ test/test_kernel_shell.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/test/test_kernel.py b/test/test_kernel.py index f681a0e..c56b614 100644 --- a/test/test_kernel.py +++ b/test/test_kernel.py @@ -31,6 +31,9 @@ def test_xeus_stderr(self): self.assertEqual(output_msgs[0]['content']['name'], 'stderr') self.assertEqual(output_msgs[0]['content']['text'], 'error') +class XeusIopubWelcomeTests(jupyter_kernel_test.IopubWelcomeTests): + + kernel_name = "test_kernel" if __name__ == '__main__': unittest.main() diff --git a/test/test_kernel_control.py b/test/test_kernel_control.py index c1607c3..ce36ca8 100644 --- a/test/test_kernel_control.py +++ b/test/test_kernel_control.py @@ -31,6 +31,9 @@ def test_xeus_stderr(self): self.assertEqual(output_msgs[0]['content']['name'], 'stderr') self.assertEqual(output_msgs[0]['content']['text'], 'error') +class XeusIopubWelcomeTests(jupyter_kernel_test.IopubWelcomeTests): + + kernel_name = "test_kernel_control" if __name__ == '__main__': unittest.main() diff --git a/test/test_kernel_shell.py b/test/test_kernel_shell.py index 1b64afc..efa531c 100644 --- a/test/test_kernel_shell.py +++ b/test/test_kernel_shell.py @@ -31,6 +31,9 @@ def test_xeus_stderr(self): self.assertEqual(output_msgs[0]['content']['name'], 'stderr') self.assertEqual(output_msgs[0]['content']['text'], 'error') +class XeusIopubWelcomeTests(jupyter_kernel_test.IopubWelcomeTests): + + kernel_name = "test_kernel_shell" if __name__ == '__main__': unittest.main() From a5301f24fee419320c00522814e107a539d1cf1d Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Wed, 12 Jul 2023 09:54:06 +0200 Subject: [PATCH 4/5] Add iopub welcome test flag --- test/test_kernel.py | 1 + test/test_kernel_control.py | 1 + test/test_kernel_shell.py | 1 + 3 files changed, 3 insertions(+) diff --git a/test/test_kernel.py b/test/test_kernel.py index c56b614..d025c76 100644 --- a/test/test_kernel.py +++ b/test/test_kernel.py @@ -34,6 +34,7 @@ def test_xeus_stderr(self): class XeusIopubWelcomeTests(jupyter_kernel_test.IopubWelcomeTests): kernel_name = "test_kernel" + support_iopub_welcome = True if __name__ == '__main__': unittest.main() diff --git a/test/test_kernel_control.py b/test/test_kernel_control.py index ce36ca8..74294e1 100644 --- a/test/test_kernel_control.py +++ b/test/test_kernel_control.py @@ -34,6 +34,7 @@ def test_xeus_stderr(self): class XeusIopubWelcomeTests(jupyter_kernel_test.IopubWelcomeTests): kernel_name = "test_kernel_control" + support_iopub_welcome = True if __name__ == '__main__': unittest.main() diff --git a/test/test_kernel_shell.py b/test/test_kernel_shell.py index efa531c..5b9aa25 100644 --- a/test/test_kernel_shell.py +++ b/test/test_kernel_shell.py @@ -34,6 +34,7 @@ def test_xeus_stderr(self): class XeusIopubWelcomeTests(jupyter_kernel_test.IopubWelcomeTests): kernel_name = "test_kernel_shell" + support_iopub_welcome = True if __name__ == '__main__': unittest.main() From 0fb77fee3cf84d14cff730130955b9b0599e8770 Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Tue, 5 Sep 2023 14:00:37 +0200 Subject: [PATCH 5/5] Update to JKT v0.6 --- environment-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment-dev.yml b/environment-dev.yml index 131815a..9906a96 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -19,4 +19,4 @@ dependencies: # Test dependencies - doctest >= 2.4.6 - pytest - - jupyter_kernel_test>=0.5,<0.6 + - jupyter_kernel_test>=0.6,<0.7