Merge pull request #4284 from takluyver/i4283

More selective filename test in list_running_servers
Thomas Kluyver 7 years ago committed by GitHub
commit cf1b7b3628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1839,7 +1839,7 @@ def list_running_servers(runtime_dir=None):
return
for file_name in os.listdir(runtime_dir):
if file_name.startswith('nbserver-'):
if re.match('nbserver-(.+).json', file_name):
with io.open(os.path.join(runtime_dir, file_name), encoding='utf-8') as f:
info = json.load(f)

@ -25,6 +25,8 @@ from notebook import notebookapp, __version__
from notebook.auth.security import passwd_check
NotebookApp = notebookapp.NotebookApp
from .launchnotebook import NotebookTestBase
def test_help_output():
"""ipython notebook --help-all works"""
@ -183,3 +185,10 @@ def test_notebook_stop():
app.start()
nt.assert_equal(exc.exception.code, 1)
nt.assert_equal(len(app.servers_shut_down), 0)
class NotebookAppTests(NotebookTestBase):
def test_list_running_servers(self):
servers = list(notebookapp.list_running_servers())
assert len(servers) >= 1
assert self.port in {info['port'] for info in servers}

Loading…
Cancel
Save