From 515f8e22dc1d26a5d0bd2f50aa0a57b87e82f690 Mon Sep 17 00:00:00 2001 From: M Pacer Date: Tue, 27 Mar 2018 09:21:15 -0700 Subject: [PATCH] nicer error and use append directly do not iterate over cells --- notebook/tests/selenium/quick_selenium.py | 7 ++++++- notebook/tests/selenium/test_markdown.py | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/notebook/tests/selenium/quick_selenium.py b/notebook/tests/selenium/quick_selenium.py index e0cef58f1..489002597 100644 --- a/notebook/tests/selenium/quick_selenium.py +++ b/notebook/tests/selenium/quick_selenium.py @@ -3,6 +3,10 @@ from selenium.webdriver import Firefox from notebook.tests.selenium.utils import Notebook from notebook.notebookapp import list_running_servers +class NoServerError(Exception): + + def __init__(self, message): + self.message = message def quick_driver(lab=False): """Quickly create a selenium driver pointing at an active noteboook server. @@ -17,7 +21,8 @@ def quick_driver(lab=False): try: server = list(list_running_servers())[0] except IndexError as e: - e.message = 'You need a server running before you can run this command' + raise NoServerError('You need a server running before you can run ' + 'this command') driver = Firefox() auth_url = '{url}?token={token}'.format(**server) driver.get(auth_url) diff --git a/notebook/tests/selenium/test_markdown.py b/notebook/tests/selenium/test_markdown.py index df95d57b2..c71ef8a17 100644 --- a/notebook/tests/selenium/test_markdown.py +++ b/notebook/tests/selenium/test_markdown.py @@ -37,8 +37,7 @@ def test_markdown_cell(notebook): '
x = 1\n
', '
x = 1\n
' ] - for i, cell in enumerate(nb): - nb.append(*cell_text, cell_type="markdown") + nb.append(*cell_text, cell_type="markdown") nb.run_all() rendered_contents = get_rendered_contents(nb) assert rendered_contents == expected_contents