##// END OF EJS Templates
Option to spew subprocess streams during tests...
Option to spew subprocess streams during tests This supersedes PR #4268. Run the tests with '--subproc-streams show' to show output from subprocesses (kernels, IPython.parallel components) in the terminal, or with '--subproc-streams discard' to send it to /dev/null. By default (or with '--subproc-streams capture') the output is piped, captured and displayed only when tests fail. But in some situations, a test fails because of an error which actually occurred earlier, so you have to see all the output.

File last commit:

r11360:f3aabe2e
r13824:d77e2f51
Show More
embedded_terminal.py
30 lines | 794 B | text/x-python | PythonLexer
import os
from IPython.kernel.inprocess import InProcessKernelManager
from IPython.terminal.console.interactiveshell import ZMQTerminalInteractiveShell
def print_process_id():
print 'Process ID is:', os.getpid()
def main():
print_process_id()
# Create an in-process kernel
# >>> print_process_id()
# will print the same process ID as the main process
kernel_manager = InProcessKernelManager()
kernel_manager.start_kernel()
kernel = kernel_manager.kernel
kernel.gui = 'qt4'
kernel.shell.push({'foo': 43, 'print_process_id': print_process_id})
client = kernel_manager.client()
client.start_channels()
shell = ZMQTerminalInteractiveShell(manager=kernel_manager, client=client)
shell.mainloop()
if __name__ == '__main__':
main()