@@ -24,7 +24,12 @@ def initialize(self, argv=[]):
24
24
25
25
sample_info = dict (ip = '1.2.3.4' , transport = 'ipc' ,
26
26
shell_port = 1 , hb_port = 2 , iopub_port = 3 , stdin_port = 4 , control_port = 5 ,
27
- key = b'abc123' , signature_scheme = 'hmac-md5' ,
27
+ key = b'abc123' , signature_scheme = 'hmac-md5' , kernel_name = 'python'
28
+ )
29
+
30
+ sample_info_kn = dict (ip = '1.2.3.4' , transport = 'ipc' ,
31
+ shell_port = 1 , hb_port = 2 , iopub_port = 3 , stdin_port = 4 , control_port = 5 ,
32
+ key = b'abc123' , signature_scheme = 'hmac-md5' , kernel_name = 'test'
28
33
)
29
34
30
35
def test_write_connection_file ():
@@ -55,6 +60,23 @@ def test_load_connection_file_session():
55
60
nt .assert_equal (session .signature_scheme , sample_info ['signature_scheme' ])
56
61
57
62
63
+ def test_load_connection_file_session_with_kn ():
64
+ """test load_connection_file() after """
65
+ session = Session ()
66
+ app = DummyConsoleApp (session = Session ())
67
+ app .initialize (argv = [])
68
+ session = app .session
69
+
70
+ with TemporaryDirectory () as d :
71
+ cf = os .path .join (d , 'kernel.json' )
72
+ connect .write_connection_file (cf , ** sample_info_kn )
73
+ app .connection_file = cf
74
+ app .load_connection_file ()
75
+
76
+ nt .assert_equal (session .key , sample_info_kn ['key' ])
77
+ nt .assert_equal (session .signature_scheme , sample_info_kn ['signature_scheme' ])
78
+
79
+
58
80
def test_app_load_connection_file ():
59
81
"""test `ipython console --existing` loads a connection file"""
60
82
with TemporaryDirectory () as d :
0 commit comments