def start_new_kernel(**kwargs): """start a new kernel, and return its Manager and Client Integrates with our output capturing for tests. """ kwargs.update(dict(stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT)) return manager.start_new_kernel(startup_timeout=STARTUP_TIMEOUT, **kwargs)
def start_new_kernel(**kwargs): """start a new kernel, and return its Manager and Client Integrates with our output capturing for tests. """ kwargs['stderr'] = STDOUT try: kwargs['stdout'] = nose.iptest_stdstreams_fileno() except AttributeError: pass return manager.start_new_kernel(startup_timeout=STARTUP_TIMEOUT, **kwargs)
def start_new_kernel(**kwargs): """start a new kernel, and return its Manager and Client Integrates with our output capturing for tests. """ try: stdout = nose.iptest_stdstreams_fileno() except AttributeError: stdout = open(os.devnull) kwargs.update(dict(stdout=stdout, stderr=STDOUT)) return manager.start_new_kernel(startup_timeout=STARTUP_TIMEOUT, **kwargs)
def start(self): if self.state == "before": # Store stdout & stderr to show with failing tests. # This is defined in IPython.testing.iptest self.process = Popen( self.args, stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT, env=os.environ, cwd=self.work_dir ) self.notify_start(self.process.pid) self.poll = self.process.poll else: s = "The process was already started and has state: %r" % self.state raise ProcessStateError(s)
def new_kernel(argv=None): """Context manager for a new kernel in a subprocess Should only be used for tests where the kernel must not be re-used. Returns ------- kernel_client: connected KernelClient instance """ kwargs = dict(stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT, startup_timeout=STARTUP_TIMEOUT) if argv is not None: kwargs["extra_arguments"] = argv return manager.run_kernel(**kwargs)
def start(self): if self.state == 'before': # Store stdout & stderr to show with failing tests. # This is defined in IPython.testing.iptest self.process = Popen(self.args, stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT, env=os.environ, cwd=self.work_dir) self.notify_start(self.process.pid) self.poll = self.process.poll else: s = 'The process was already started and has state: %r' % self.state raise ProcessStateError(s)
def start_new_kernel(argv=None): """start a new kernel, and return its Manager and Client""" km = KernelManager() kwargs = dict(stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT) if argv: kwargs['extra_arguments'] = argv km.start_kernel(**kwargs) kc = km.client() kc.start_channels() msg_id = kc.kernel_info() kc.get_shell_msg(block=True, timeout=STARTUP_TIMEOUT) flush_channels(kc) return km, kc
def new_kernel(argv=None): """Context manager for a new kernel in a subprocess Should only be used for tests where the kernel must not be re-used. Returns ------- kernel_client: connected KernelClient instance """ kwargs = dict(stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT, startup_timeout=STARTUP_TIMEOUT) if argv is not None: kwargs['extra_arguments'] = argv return manager.run_kernel(**kwargs)
def setup_class(cls): cls.ipython_dir = TemporaryDirectory() cls.notebook_dir = TemporaryDirectory() notebook_args = [ sys.executable, '-c', 'from IPython.html.notebookapp import launch_new_instance; launch_new_instance()', '--port=%d' % cls.port, '--no-browser', '--ipython-dir=%s' % cls.ipython_dir.name, '--notebook-dir=%s' % cls.notebook_dir.name, ] cls.notebook = Popen(notebook_args, stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT, ) cls.wait_until_alive()
def new_kernel(argv=None): """Context manager for a new kernel in a subprocess Should only be used for tests where the kernel must not be re-used. Returns ------- kernel_client: connected KernelClient instance """ kwargs = {'stderr': STDOUT} try: kwargs['stdout'] = nose.iptest_stdstreams_fileno() except AttributeError: pass if argv is not None: kwargs['extra_arguments'] = argv return manager.run_kernel(**kwargs)
def setup_class(cls): cls.ipython_dir = TemporaryDirectory() cls.notebook_dir = TemporaryDirectory() notebook_args = [ sys.executable, '-c', 'from IPython.html.notebookapp import launch_new_instance; launch_new_instance()', '--port=%d' % cls.port, '--port-retries=0', # Don't try any other ports '--no-browser', '--ipython-dir=%s' % cls.ipython_dir.name, '--notebook-dir=%s' % cls.notebook_dir.name, ] cls.notebook = Popen(notebook_args, stdout=nose.iptest_stdstreams_fileno(), stderr=STDOUT, ) cls.wait_until_alive()