Show More
@@ -7,13 +7,18 b'' | |||||
7 | import glob |
|
7 | import glob | |
8 | import os |
|
8 | import os | |
9 | import re |
|
9 | import re | |
|
10 | import sys | |||
10 | import tarfile |
|
11 | import tarfile | |
11 | import zipfile |
|
12 | import zipfile | |
12 | from io import BytesIO |
|
13 | from io import BytesIO, StringIO | |
13 | from os.path import basename, join as pjoin |
|
14 | from os.path import basename, join as pjoin | |
14 | from unittest import TestCase |
|
15 | from unittest import TestCase | |
15 |
|
16 | |||
16 | import IPython.testing.tools as tt |
|
17 | try: | |
|
18 | from unittest import mock | |||
|
19 | except ImportError: | |||
|
20 | import mock # py2 | |||
|
21 | ||||
17 | import IPython.testing.decorators as dec |
|
22 | import IPython.testing.decorators as dec | |
18 | from IPython.utils import py3compat |
|
23 | from IPython.utils import py3compat | |
19 | from IPython.utils.tempdir import TemporaryDirectory |
|
24 | from IPython.utils.tempdir import TemporaryDirectory | |
@@ -213,8 +218,13 b' class TestInstallNBExtension(TestCase):' | |||||
213 | self.assertEqual(new_mtime, old_mtime) |
|
218 | self.assertEqual(new_mtime, old_mtime) | |
214 |
|
219 | |||
215 | def test_quiet(self): |
|
220 | def test_quiet(self): | |
216 | with tt.AssertNotPrints(re.compile(r'.+')): |
|
221 | stdout = StringIO() | |
|
222 | stderr = StringIO() | |||
|
223 | with mock.patch.object(sys, 'stdout', stdout), \ | |||
|
224 | mock.patch.object(sys, 'stderr', stderr): | |||
217 | install_nbextension(self.src, verbose=0) |
|
225 | install_nbextension(self.src, verbose=0) | |
|
226 | self.assertEqual(stdout.getvalue(), '') | |||
|
227 | self.assertEqual(stderr.getvalue(), '') | |||
218 |
|
228 | |||
219 | def test_install_zip(self): |
|
229 | def test_install_zip(self): | |
220 | path = pjoin(self.src, "myjsext.zip") |
|
230 | path = pjoin(self.src, "myjsext.zip") |
General Comments 0
You need to be logged in to leave comments.
Login now