##// END OF EJS Templates
ZMQHistoryManager made to work with testing KernelClient which has no history method
Doug Blank -
Show More
@@ -45,19 +45,21 b' class ZMQHistoryManager(HistoryAccessorBase):'
45 Load the history over ZMQ from the kernel. Wraps the history
45 Load the history over ZMQ from the kernel. Wraps the history
46 messaging with loop to wait to get history results.
46 messaging with loop to wait to get history results.
47 """
47 """
48 msg_id = self.client.history(raw=raw, output=output,
49 hist_access_type=hist_access_type,
50 **kwargs)
51 history = []
48 history = []
52 while True:
49 if hasattr(self.client, "history"):
53 try:
50 ## In tests, KernelClient may not have a history method
54 reply = self.client.get_shell_msg(timeout=1)
51 msg_id = self.client.history(raw=raw, output=output,
55 except Empty:
52 hist_access_type=hist_access_type,
56 break
53 **kwargs)
57 else:
54 while True:
58 if reply['parent_header'].get('msg_id') == msg_id:
55 try:
59 history = reply['content'].get('history', [])
56 reply = self.client.get_shell_msg(timeout=1)
57 except Empty:
60 break
58 break
59 else:
60 if reply['parent_header'].get('msg_id') == msg_id:
61 history = reply['content'].get('history', [])
62 break
61 return history
63 return history
62
64
63 def get_tail(self, n=10, raw=True, output=False, include_latest=False):
65 def get_tail(self, n=10, raw=True, output=False, include_latest=False):
General Comments 0
You need to be logged in to leave comments. Login now