Capture server logs when running notebook tests

This commit is contained in:
Thomas Kluyver 2013-12-09 12:33:03 -08:00
parent c5d0f1614f
commit c2644a20be

View File

@ -1,13 +1,14 @@
"""Base class for notebook tests.""" """Base class for notebook tests."""
import os
import sys import sys
import time import time
import requests import requests
from contextlib import contextmanager from contextlib import contextmanager
from subprocess import Popen, PIPE from subprocess import Popen, STDOUT
from unittest import TestCase from unittest import TestCase
import nose
from IPython.utils.tempdir import TemporaryDirectory from IPython.utils.tempdir import TemporaryDirectory
class NotebookTestBase(TestCase): class NotebookTestBase(TestCase):
@ -55,11 +56,11 @@ class NotebookTestBase(TestCase):
'--ipython-dir=%s' % cls.ipython_dir.name, '--ipython-dir=%s' % cls.ipython_dir.name,
'--notebook-dir=%s' % cls.notebook_dir.name, '--notebook-dir=%s' % cls.notebook_dir.name,
] ]
devnull = open(os.devnull, 'w')
cls.notebook = Popen(notebook_args, cls.notebook = Popen(notebook_args,
stdout=devnull, stdout=nose.ipy_stream_capturer.writefd,
stderr=devnull, stderr=STDOUT,
) )
nose.ipy_stream_capturer.ensure_started()
cls.wait_until_alive() cls.wait_until_alive()
@classmethod @classmethod