-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #575 from rayosborn/fix-inprocess-channel
Add missing `closed` method to `QtInProcessChannel`
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ __pycache__ | |
.#* | ||
.coverage | ||
.pytest_cache | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Test QtInProcessKernel""" | ||
|
||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
import unittest | ||
|
||
from qtconsole.inprocess import QtInProcessKernelManager | ||
|
||
|
||
class InProcessTests(unittest.TestCase): | ||
|
||
def setUp(self): | ||
"""Open an in-process kernel.""" | ||
self.kernel_manager = QtInProcessKernelManager() | ||
self.kernel_manager.start_kernel() | ||
self.kernel_client = self.kernel_manager.client() | ||
|
||
def tearDown(self): | ||
"""Shutdown the in-process kernel. """ | ||
self.kernel_client.stop_channels() | ||
self.kernel_manager.shutdown_kernel() | ||
|
||
def test_execute(self): | ||
"""Test execution of shell commands.""" | ||
# check that closed works as expected | ||
assert not self.kernel_client.iopub_channel.closed() | ||
|
||
# check that running code works | ||
self.kernel_client.execute('a=1') | ||
assert self.kernel_manager.kernel.shell.user_ns.get('a') == 1 |