File tree 2 files changed +10
-1
lines changed
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):
1839
1839
return
1840
1840
1841
1841
for file_name in os .listdir (runtime_dir ):
1842
- if file_name . startswith ('nbserver-' ):
1842
+ if re . match ('nbserver-(.+).json' , file_name ):
1843
1843
with io .open (os .path .join (runtime_dir , file_name ), encoding = 'utf-8' ) as f :
1844
1844
info = json .load (f )
1845
1845
Original file line number Diff line number Diff line change 25
25
from notebook .auth .security import passwd_check
26
26
NotebookApp = notebookapp .NotebookApp
27
27
28
+ from .launchnotebook import NotebookTestBase
29
+
28
30
29
31
def test_help_output ():
30
32
"""ipython notebook --help-all works"""
@@ -183,3 +185,10 @@ def list_running_servers(runtime_dir):
183
185
app .start ()
184
186
nt .assert_equal (exc .exception .code , 1 )
185
187
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