File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1839,7 +1839,7 @@ def list_running_servers(runtime_dir=None):
18391839 return
18401840
18411841 for file_name in os .listdir (runtime_dir ):
1842- if file_name . startswith ('nbserver-' ):
1842+ if re . match ('nbserver-(.+).json' , file_name ):
18431843 with io .open (os .path .join (runtime_dir , file_name ), encoding = 'utf-8' ) as f :
18441844 info = json .load (f )
18451845
Original file line number Diff line number Diff line change 2525from notebook .auth .security import passwd_check
2626NotebookApp = notebookapp .NotebookApp
2727
28+ from .launchnotebook import NotebookTestBase
29+
2830
2931def test_help_output ():
3032 """ipython notebook --help-all works"""
@@ -183,3 +185,10 @@ def list_running_servers(runtime_dir):
183185 app .start ()
184186 nt .assert_equal (exc .exception .code , 1 )
185187 nt .assert_equal (len (app .servers_shut_down ), 0 )
188+
189+
190+ class NotebookAppTests (NotebookTestBase ):
191+ def test_list_running_servers (self ):
192+ servers = list (notebookapp .list_running_servers ())
193+ assert len (servers ) >= 1
194+ assert self .port in {info ['port' ] for info in servers }
You can’t perform that action at this time.
0 commit comments