##// END OF EJS Templates
test loading connection file after instantiating Session
MinRK -
Show More
@@ -27,6 +27,7 b' from IPython.core.application import BaseIPythonApplication'
27 from IPython.utils.tempdir import TemporaryDirectory, TemporaryWorkingDirectory
27 from IPython.utils.tempdir import TemporaryDirectory, TemporaryWorkingDirectory
28 from IPython.utils.py3compat import str_to_bytes
28 from IPython.utils.py3compat import str_to_bytes
29 from IPython.kernel import connect
29 from IPython.kernel import connect
30 from IPython.kernel.zmq.session import Session
30
31
31 #-----------------------------------------------------------------------------
32 #-----------------------------------------------------------------------------
32 # Classes and functions
33 # Classes and functions
@@ -52,6 +53,24 b' def test_write_connection_file():'
52 info['key'] = str_to_bytes(info['key'])
53 info['key'] = str_to_bytes(info['key'])
53 nt.assert_equal(info, sample_info)
54 nt.assert_equal(info, sample_info)
54
55
56
57 def test_load_connection_file_session():
58 """test load_connection_file() after """
59 session = Session()
60 app = DummyConsoleApp(session=Session())
61 app.initialize(argv=[])
62 session = app.session
63
64 with TemporaryDirectory() as d:
65 cf = os.path.join(d, 'kernel.json')
66 connect.write_connection_file(cf, **sample_info)
67 app.connection_file = cf
68 app.load_connection_file()
69
70 nt.assert_equal(session.key, sample_info['key'])
71 nt.assert_equal(session.signature_scheme, sample_info['signature_scheme'])
72
73
55 def test_app_load_connection_file():
74 def test_app_load_connection_file():
56 """test `ipython console --existing` loads a connection file"""
75 """test `ipython console --existing` loads a connection file"""
57 with TemporaryDirectory() as d:
76 with TemporaryDirectory() as d:
General Comments 0
You need to be logged in to leave comments. Login now