Test for writing and removing server info files

pull/37/head
Thomas Kluyver 12 years ago
parent 71902059d3
commit 3fc26c1886

@ -14,6 +14,7 @@
import nose.tools as nt
import IPython.testing.tools as tt
from IPython.html import notebookapp
#-----------------------------------------------------------------------------
# Test functions
@ -23,3 +24,18 @@ def test_help_output():
"""ipython notebook --help-all works"""
tt.help_all_output_test('notebook')
def test_server_info_file():
nbapp = notebookapp.NotebookApp(profile='nbserver_file_test')
def get_servers():
return list(notebookapp.discover_running_servers(profile='nbserver_file_test'))
nbapp.initialize(argv=[])
nbapp.write_server_info_file()
servers = get_servers()
nt.assert_equal(len(servers), 1)
nt.assert_equal(servers[0]['port'], nbapp.port)
nt.assert_equal(servers[0]['url'], nbapp.connection_url)
nbapp.remove_server_info_file()
nt.assert_equal(get_servers(), [])
# The ENOENT error should be silenced.
nbapp.remove_server_info_file()
Loading…
Cancel
Save