Merge pull request #8255 from minrk/testing-tools

reduce use of testing.tools
Min RK 11 years ago
commit 5904b92d3b

@ -7,13 +7,18 @@
import glob
import os
import re
import sys
import tarfile
import zipfile
from io import BytesIO
from io import BytesIO, StringIO
from os.path import basename, join as pjoin
from unittest import TestCase
import IPython.testing.tools as tt
try:
from unittest import mock
except ImportError:
import mock # py2
import IPython.testing.decorators as dec
from IPython.utils import py3compat
from IPython.utils.tempdir import TemporaryDirectory
@ -213,8 +218,13 @@ class TestInstallNBExtension(TestCase):
self.assertEqual(new_mtime, old_mtime)
def test_quiet(self):
with tt.AssertNotPrints(re.compile(r'.+')):
stdout = StringIO()
stderr = StringIO()
with mock.patch.object(sys, 'stdout', stdout), \
mock.patch.object(sys, 'stderr', stderr):
install_nbextension(self.src, verbose=0)
self.assertEqual(stdout.getvalue(), '')
self.assertEqual(stderr.getvalue(), '')
def test_install_zip(self):
path = pjoin(self.src, "myjsext.zip")

@ -1,15 +1,5 @@
"""Test NotebookApp"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import logging
import os
@ -17,19 +7,17 @@ from tempfile import NamedTemporaryFile
import nose.tools as nt
from traitlets.tests.utils import check_help_all_output
from IPython.utils.tempdir import TemporaryDirectory
from IPython.utils.traitlets import TraitError
import IPython.testing.tools as tt
from IPython.html import notebookapp
NotebookApp = notebookapp.NotebookApp
#-----------------------------------------------------------------------------
# Test functions
#-----------------------------------------------------------------------------
def test_help_output():
"""ipython notebook --help-all works"""
tt.help_all_output_test('notebook')
check_help_all_output('IPython.html')
def test_server_info_file():
nbapp = NotebookApp(profile='nbserver_file_test', log=logging.getLogger())

@ -1,31 +1,21 @@
"""Test HTML utils"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import nose.tools as nt
import IPython.testing.tools as tt
from traitlets.tests.utils import check_help_all_output
from IPython.html.utils import url_escape, url_unescape, is_hidden
from IPython.utils.tempdir import TemporaryDirectory
#-----------------------------------------------------------------------------
# Test functions
#-----------------------------------------------------------------------------
def test_help_output():
"""ipython notebook --help-all works"""
tt.help_all_output_test('notebook')
"""jupyter notebook --help-all works"""
# FIXME: will be jupyter_notebook
check_help_all_output('IPython.html')
def test_url_escape():

Loading…
Cancel
Save