Show More
@@ -0,0 +1,40 b'' | |||
|
1 | import sys | |
|
2 | import nose.tools as nt | |
|
3 | ||
|
4 | from subprocess import Popen, PIPE | |
|
5 | ||
|
6 | def get_output_error_code(cmd): | |
|
7 | """Get stdout, stderr, and exit code from running a command""" | |
|
8 | p = Popen(cmd, stdout=PIPE, stderr=PIPE) | |
|
9 | out, err = p.communicate() | |
|
10 | out = out.decode('utf8', 'replace') | |
|
11 | err = err.decode('utf8', 'replace') | |
|
12 | return out, err, p.returncode | |
|
13 | ||
|
14 | ||
|
15 | def check_help_output(pkg, subcommand=None): | |
|
16 | """test that `python -m PKG [subcommand] -h` works""" | |
|
17 | cmd = [sys.executable, '-m', pkg] | |
|
18 | if subcommand: | |
|
19 | cmd.extend(subcommand) | |
|
20 | cmd.append('-h') | |
|
21 | out, err, rc = get_output_error_code(cmd) | |
|
22 | nt.assert_equal(rc, 0, err) | |
|
23 | nt.assert_not_in("Traceback", err) | |
|
24 | nt.assert_in("Options", out) | |
|
25 | nt.assert_in("--help-all", out) | |
|
26 | return out, err | |
|
27 | ||
|
28 | ||
|
29 | def check_help_all_output(pkg, subcommand=None): | |
|
30 | """test that `python -m PKG --help-all` works""" | |
|
31 | cmd = [sys.executable, '-m', pkg] | |
|
32 | if subcommand: | |
|
33 | cmd.extend(subcommand) | |
|
34 | cmd.append('--help-all') | |
|
35 | out, err, rc = get_output_error_code(cmd) | |
|
36 | nt.assert_equal(rc, 0, err) | |
|
37 | nt.assert_not_in("Traceback", err) | |
|
38 | nt.assert_in("Options", out) | |
|
39 | nt.assert_in("Class parameters", out) | |
|
40 | return out, err |
@@ -7,13 +7,18 b'' | |||
|
7 | 7 | import glob |
|
8 | 8 | import os |
|
9 | 9 | import re |
|
10 | import sys | |
|
10 | 11 | import tarfile |
|
11 | 12 | import zipfile |
|
12 | from io import BytesIO | |
|
13 | from io import BytesIO, StringIO | |
|
13 | 14 | from os.path import basename, join as pjoin |
|
14 | 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 | 22 | import IPython.testing.decorators as dec |
|
18 | 23 | from IPython.utils import py3compat |
|
19 | 24 | from IPython.utils.tempdir import TemporaryDirectory |
@@ -213,8 +218,13 b' class TestInstallNBExtension(TestCase):' | |||
|
213 | 218 | self.assertEqual(new_mtime, old_mtime) |
|
214 | 219 | |
|
215 | 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 | 225 | install_nbextension(self.src, verbose=0) |
|
226 | self.assertEqual(stdout.getvalue(), '') | |
|
227 | self.assertEqual(stderr.getvalue(), '') | |
|
218 | 228 | |
|
219 | 229 | def test_install_zip(self): |
|
220 | 230 | path = pjoin(self.src, "myjsext.zip") |
@@ -1,15 +1,5 b'' | |||
|
1 | 1 | """Test NotebookApp""" |
|
2 | 2 | |
|
3 | #----------------------------------------------------------------------------- | |
|
4 | # Copyright (C) 2013 The IPython Development Team | |
|
5 | # | |
|
6 | # Distributed under the terms of the BSD License. The full license is in | |
|
7 | # the file COPYING, distributed as part of this software. | |
|
8 | #----------------------------------------------------------------------------- | |
|
9 | ||
|
10 | #----------------------------------------------------------------------------- | |
|
11 | # Imports | |
|
12 | #----------------------------------------------------------------------------- | |
|
13 | 3 | |
|
14 | 4 | import logging |
|
15 | 5 | import os |
@@ -17,19 +7,17 b' from tempfile import NamedTemporaryFile' | |||
|
17 | 7 | |
|
18 | 8 | import nose.tools as nt |
|
19 | 9 | |
|
10 | from traitlets.tests.utils import check_help_all_output | |
|
11 | ||
|
20 | 12 | from IPython.utils.tempdir import TemporaryDirectory |
|
21 | 13 | from IPython.utils.traitlets import TraitError |
|
22 | import IPython.testing.tools as tt | |
|
23 | 14 | from IPython.html import notebookapp |
|
24 | 15 | NotebookApp = notebookapp.NotebookApp |
|
25 | 16 | |
|
26 | #----------------------------------------------------------------------------- | |
|
27 | # Test functions | |
|
28 | #----------------------------------------------------------------------------- | |
|
29 | 17 | |
|
30 | 18 | def test_help_output(): |
|
31 | 19 | """ipython notebook --help-all works""" |
|
32 |
|
|
|
20 | check_help_all_output('IPython.html') | |
|
33 | 21 | |
|
34 | 22 | def test_server_info_file(): |
|
35 | 23 | nbapp = NotebookApp(profile='nbserver_file_test', log=logging.getLogger()) |
@@ -1,31 +1,21 b'' | |||
|
1 | 1 | """Test HTML utils""" |
|
2 | 2 | |
|
3 | #----------------------------------------------------------------------------- | |
|
4 | # Copyright (C) 2013 The IPython Development Team | |
|
5 | # | |
|
6 | # Distributed under the terms of the BSD License. The full license is in | |
|
7 | # the file COPYING, distributed as part of this software. | |
|
8 | #----------------------------------------------------------------------------- | |
|
9 | ||
|
10 | #----------------------------------------------------------------------------- | |
|
11 | # Imports | |
|
12 | #----------------------------------------------------------------------------- | |
|
3 | # Copyright (c) Jupyter Development Team. | |
|
4 | # Distributed under the terms of the Modified BSD License. | |
|
13 | 5 | |
|
14 | 6 | import os |
|
15 | 7 | |
|
16 | 8 | import nose.tools as nt |
|
17 | 9 | |
|
18 | import IPython.testing.tools as tt | |
|
10 | from traitlets.tests.utils import check_help_all_output | |
|
19 | 11 | from IPython.html.utils import url_escape, url_unescape, is_hidden |
|
20 | 12 | from IPython.utils.tempdir import TemporaryDirectory |
|
21 | 13 | |
|
22 | #----------------------------------------------------------------------------- | |
|
23 | # Test functions | |
|
24 | #----------------------------------------------------------------------------- | |
|
25 | 14 | |
|
26 | 15 | def test_help_output(): |
|
27 |
""" |
|
|
28 | tt.help_all_output_test('notebook') | |
|
16 | """jupyter notebook --help-all works""" | |
|
17 | # FIXME: will be jupyter_notebook | |
|
18 | check_help_all_output('IPython.html') | |
|
29 | 19 | |
|
30 | 20 | |
|
31 | 21 | def test_url_escape(): |
@@ -465,23 +465,3 b" def help_all_output_test(subcommand=''):" | |||
|
465 | 465 | nt.assert_in("Class parameters", out) |
|
466 | 466 | return out, err |
|
467 | 467 | |
|
468 | def assert_big_text_equal(a, b, chunk_size=80): | |
|
469 | """assert that large strings are equal | |
|
470 | ||
|
471 | Zooms in on first chunk that differs, | |
|
472 | to give better info than vanilla assertEqual for large text blobs. | |
|
473 | """ | |
|
474 | for i in range(0, len(a), chunk_size): | |
|
475 | chunk_a = a[i:i + chunk_size] | |
|
476 | chunk_b = b[i:i + chunk_size] | |
|
477 | nt.assert_equal(chunk_a, chunk_b, "[offset: %i]\n%r != \n%r" % ( | |
|
478 | i, chunk_a, chunk_b)) | |
|
479 | ||
|
480 | if len(a) > len(b): | |
|
481 | nt.fail("Length doesn't match (%i > %i). Extra text:\n%r" % ( | |
|
482 | len(a), len(b), a[len(b):] | |
|
483 | )) | |
|
484 | elif len(a) < len(b): | |
|
485 | nt.fail("Length doesn't match (%i < %i). Extra text:\n%r" % ( | |
|
486 | len(a), len(b), b[len(a):] | |
|
487 | )) |
@@ -1,28 +1,15 b'' | |||
|
1 | """Tests for two-process terminal frontend | |
|
1 | """Tests for two-process terminal frontend""" | |
|
2 | 2 | |
|
3 | Currently only has the most simple test possible, starting a console and running | |
|
4 | a single command. | |
|
5 | ||
|
6 | Authors: | |
|
7 | ||
|
8 | * Min RK | |
|
9 | """ | |
|
10 | ||
|
11 | #----------------------------------------------------------------------------- | |
|
12 | # Imports | |
|
13 | #----------------------------------------------------------------------------- | |
|
3 | # Copyright (c) Jupyter Development Team. | |
|
4 | # Distributed under the terms of the Modified BSD License. | |
|
14 | 5 | |
|
15 | 6 | import sys |
|
16 | 7 | |
|
17 | 8 | from nose import SkipTest |
|
18 | 9 | |
|
19 | import IPython.testing.tools as tt | |
|
10 | from traitlets.tests.utils import check_help_all_output | |
|
20 | 11 | from IPython.testing import decorators as dec |
|
21 | 12 | |
|
22 | #----------------------------------------------------------------------------- | |
|
23 | # Tests | |
|
24 | #----------------------------------------------------------------------------- | |
|
25 | ||
|
26 | 13 | @dec.skip_win32 |
|
27 | 14 | def test_console_starts(): |
|
28 | 15 | """test that `ipython console` starts a terminal""" |
@@ -34,8 +21,7 b' def test_console_starts():' | |||
|
34 | 21 | |
|
35 | 22 | def test_help_output(): |
|
36 | 23 | """ipython console --help-all works""" |
|
37 |
|
|
|
38 | ||
|
24 | check_help_all_output('jupyter_console') | |
|
39 | 25 | |
|
40 | 26 | def test_display_text(): |
|
41 | 27 | "Ensure display protocol plain/text key is supported" |
@@ -14,7 +14,6 b' except ImportError:' | |||
|
14 | 14 | from IPython.kernel import KernelClient |
|
15 | 15 | from IPython.terminal.console.interactiveshell import ZMQTerminalInteractiveShell |
|
16 | 16 | from IPython.utils.tempdir import TemporaryDirectory |
|
17 | from IPython.testing.tools import monkeypatch | |
|
18 | 17 | from IPython.testing.decorators import skip_without |
|
19 | 18 | from IPython.utils.ipstruct import Struct |
|
20 | 19 |
@@ -9,7 +9,7 b' from .base import ExportersTestsBase' | |||
|
9 | 9 | from ..notebook import NotebookExporter |
|
10 | 10 | |
|
11 | 11 | from IPython.nbformat import validate |
|
12 |
from |
|
|
12 | from jupyter_nbconvert.tests.base import assert_big_text_equal | |
|
13 | 13 | |
|
14 | 14 | class TestNotebookExporter(ExportersTestsBase): |
|
15 | 15 | """Contains test functions for notebook.py""" |
@@ -6,17 +6,17 b'' | |||
|
6 | 6 | import io |
|
7 | 7 | import os |
|
8 | 8 | import glob |
|
9 | import shlex | |
|
9 | 10 | import shutil |
|
11 | import sys | |
|
10 | 12 | import unittest |
|
11 | 13 | |
|
14 | import nose.tools as nt | |
|
15 | ||
|
12 | 16 | from IPython.nbformat import v4, write |
|
13 | 17 | from IPython.utils.tempdir import TemporaryWorkingDirectory |
|
14 | 18 | from IPython.utils.process import get_output_error_code |
|
15 | from IPython.testing.tools import get_ipython_cmd | |
|
16 | ||
|
17 | # a trailing space allows for simpler concatenation with the other arguments | |
|
18 | ipy_cmd = get_ipython_cmd(as_string=True) + " " | |
|
19 | ||
|
19 | from IPython.utils.py3compat import string_types | |
|
20 | 20 | |
|
21 | 21 | class TestsBase(unittest.TestCase): |
|
22 | 22 | """Base tests class. Contains useful fuzzy comparison and nbconvert |
@@ -126,20 +126,43 b' class TestsBase(unittest.TestCase):' | |||
|
126 | 126 | return os.path.join(path, *names) |
|
127 | 127 | |
|
128 | 128 | |
|
129 |
def |
|
|
129 | def nbconvert(self, parameters, ignore_return_code=False): | |
|
130 | 130 | """ |
|
131 |
|
|
|
131 | Run nbconvert a, IPython shell command, listening for both Errors and non-zero | |
|
132 | 132 | return codes. |
|
133 | 133 | |
|
134 | 134 | Parameters |
|
135 | 135 | ---------- |
|
136 | parameters : str | |
|
136 | parameters : str, list(str) | |
|
137 | 137 | List of parameters to pass to IPython. |
|
138 | 138 | ignore_return_code : optional bool (default False) |
|
139 | 139 | Throw an OSError if the return code |
|
140 | 140 | """ |
|
141 | ||
|
142 | stdout, stderr, retcode = get_output_error_code(ipy_cmd + parameters) | |
|
141 | if isinstance(parameters, string_types): | |
|
142 | parameters = shlex.split(parameters) | |
|
143 | cmd = [sys.executable, '-m', 'jupyter_nbconvert'] + parameters | |
|
144 | stdout, stderr, retcode = get_output_error_code(cmd) | |
|
143 | 145 | if not (retcode == 0 or ignore_return_code): |
|
144 | 146 | raise OSError(stderr) |
|
145 | 147 | return stdout, stderr |
|
148 | ||
|
149 | def assert_big_text_equal(a, b, chunk_size=80): | |
|
150 | """assert that large strings are equal | |
|
151 | ||
|
152 | Zooms in on first chunk that differs, | |
|
153 | to give better info than vanilla assertEqual for large text blobs. | |
|
154 | """ | |
|
155 | for i in range(0, len(a), chunk_size): | |
|
156 | chunk_a = a[i:i + chunk_size] | |
|
157 | chunk_b = b[i:i + chunk_size] | |
|
158 | nt.assert_equal(chunk_a, chunk_b, "[offset: %i]\n%r != \n%r" % ( | |
|
159 | i, chunk_a, chunk_b)) | |
|
160 | ||
|
161 | if len(a) > len(b): | |
|
162 | nt.fail("Length doesn't match (%i > %i). Extra text:\n%r" % ( | |
|
163 | len(a), len(b), a[len(b):] | |
|
164 | )) | |
|
165 | elif len(a) < len(b): | |
|
166 | nt.fail("Length doesn't match (%i < %i). Extra text:\n%r" % ( | |
|
167 | len(a), len(b), b[len(a):] | |
|
168 | )) |
@@ -11,7 +11,7 b' import sys' | |||
|
11 | 11 | from .base import TestsBase |
|
12 | 12 | from ..postprocessors import PostProcessorBase |
|
13 | 13 | |
|
14 | import IPython.testing.tools as tt | |
|
14 | from traitlets.tests.utils import check_help_all_output | |
|
15 | 15 | from IPython.testing import decorators as dec |
|
16 | 16 | |
|
17 | 17 | #----------------------------------------------------------------------------- |
@@ -29,19 +29,19 b' class TestNbConvertApp(TestsBase):' | |||
|
29 | 29 | def test_notebook_help(self): |
|
30 | 30 | """Will help show if no notebooks are specified?""" |
|
31 | 31 | with self.create_temp_cwd(): |
|
32 |
out, err = self. |
|
|
32 | out, err = self.nbconvert('--log-level 0', ignore_return_code=True) | |
|
33 | 33 | self.assertIn("see '--help-all'", out) |
|
34 | 34 | |
|
35 | 35 | def test_help_output(self): |
|
36 | 36 | """ipython nbconvert --help-all works""" |
|
37 |
|
|
|
37 | check_help_all_output('jupyter_nbconvert') | |
|
38 | 38 | |
|
39 | 39 | def test_glob(self): |
|
40 | 40 | """ |
|
41 | 41 | Do search patterns work for notebook names? |
|
42 | 42 | """ |
|
43 | 43 | with self.create_temp_cwd(['notebook*.ipynb']): |
|
44 |
self. |
|
|
44 | self.nbconvert('--to python *.ipynb --log-level 0') | |
|
45 | 45 | assert os.path.isfile('notebook1.py') |
|
46 | 46 | assert os.path.isfile('notebook2.py') |
|
47 | 47 | |
@@ -52,7 +52,7 b' class TestNbConvertApp(TestsBase):' | |||
|
52 | 52 | """ |
|
53 | 53 | with self.create_temp_cwd(): |
|
54 | 54 | self.copy_files_to(['notebook*.ipynb'], 'subdir/') |
|
55 |
self. |
|
|
55 | self.nbconvert('--to python --log-level 0 ' + | |
|
56 | 56 | os.path.join('subdir', '*.ipynb')) |
|
57 | 57 | assert os.path.isfile('notebook1.py') |
|
58 | 58 | assert os.path.isfile('notebook2.py') |
@@ -63,7 +63,7 b' class TestNbConvertApp(TestsBase):' | |||
|
63 | 63 | Do explicit notebook names work? |
|
64 | 64 | """ |
|
65 | 65 | with self.create_temp_cwd(['notebook*.ipynb']): |
|
66 |
self. |
|
|
66 | self.nbconvert('--log-level 0 --to python notebook2') | |
|
67 | 67 | assert not os.path.isfile('notebook1.py') |
|
68 | 68 | assert os.path.isfile('notebook2.py') |
|
69 | 69 | |
@@ -76,7 +76,7 b' class TestNbConvertApp(TestsBase):' | |||
|
76 | 76 | """ |
|
77 | 77 | with self.create_temp_cwd(['notebook2.ipynb']): |
|
78 | 78 | os.rename('notebook2.ipynb', 'notebook with spaces.ipynb') |
|
79 |
self. |
|
|
79 | self.nbconvert('--log-level 0 --to pdf' | |
|
80 | 80 | ' "notebook with spaces"' |
|
81 | 81 | ' --PDFExporter.latex_count=1' |
|
82 | 82 | ' --PDFExporter.verbose=True' |
@@ -86,7 +86,7 b' class TestNbConvertApp(TestsBase):' | |||
|
86 | 86 | def test_post_processor(self): |
|
87 | 87 | """Do post processors work?""" |
|
88 | 88 | with self.create_temp_cwd(['notebook1.ipynb']): |
|
89 |
out, err = self. |
|
|
89 | out, err = self.nbconvert('--log-level 0 --to python notebook1 ' | |
|
90 | 90 | '--post jupyter_nbconvert.tests.test_nbconvertapp.DummyPost') |
|
91 | 91 | self.assertIn('Dummy:notebook1.py', out) |
|
92 | 92 | |
@@ -94,11 +94,11 b' class TestNbConvertApp(TestsBase):' | |||
|
94 | 94 | def test_spurious_cr(self): |
|
95 | 95 | """Check for extra CR characters""" |
|
96 | 96 | with self.create_temp_cwd(['notebook2.ipynb']): |
|
97 |
self. |
|
|
97 | self.nbconvert('--log-level 0 --to latex notebook2') | |
|
98 | 98 | assert os.path.isfile('notebook2.tex') |
|
99 | 99 | with open('notebook2.tex') as f: |
|
100 | 100 | tex = f.read() |
|
101 |
self. |
|
|
101 | self.nbconvert('--log-level 0 --to html notebook2') | |
|
102 | 102 | assert os.path.isfile('notebook2.html') |
|
103 | 103 | with open('notebook2.html') as f: |
|
104 | 104 | html = f.read() |
@@ -109,7 +109,7 b' class TestNbConvertApp(TestsBase):' | |||
|
109 | 109 | def test_png_base64_html_ok(self): |
|
110 | 110 | """Is embedded png data well formed in HTML?""" |
|
111 | 111 | with self.create_temp_cwd(['notebook2.ipynb']): |
|
112 |
self. |
|
|
112 | self.nbconvert('--log-level 0 --to HTML ' | |
|
113 | 113 | 'notebook2.ipynb --template full') |
|
114 | 114 | assert os.path.isfile('notebook2.html') |
|
115 | 115 | with open('notebook2.html') as f: |
@@ -121,7 +121,7 b' class TestNbConvertApp(TestsBase):' | |||
|
121 | 121 | Do export templates work? |
|
122 | 122 | """ |
|
123 | 123 | with self.create_temp_cwd(['notebook2.ipynb']): |
|
124 |
self. |
|
|
124 | self.nbconvert('--log-level 0 --to slides ' | |
|
125 | 125 | 'notebook2.ipynb') |
|
126 | 126 | assert os.path.isfile('notebook2.slides.html') |
|
127 | 127 | with open('notebook2.slides.html') as f: |
@@ -130,11 +130,11 b' class TestNbConvertApp(TestsBase):' | |||
|
130 | 130 | def test_output_ext(self): |
|
131 | 131 | """test --output=outputfile[.ext]""" |
|
132 | 132 | with self.create_temp_cwd(['notebook1.ipynb']): |
|
133 |
self. |
|
|
133 | self.nbconvert('--log-level 0 --to python ' | |
|
134 | 134 | 'notebook1.ipynb --output nb.py') |
|
135 | 135 | assert os.path.exists('nb.py') |
|
136 | 136 | |
|
137 |
self. |
|
|
137 | self.nbconvert('--log-level 0 --to python ' | |
|
138 | 138 | 'notebook1.ipynb --output nb2') |
|
139 | 139 | assert os.path.exists('nb2.py') |
|
140 | 140 | |
@@ -143,7 +143,7 b' class TestNbConvertApp(TestsBase):' | |||
|
143 | 143 | Can a search pattern be used along with matching explicit notebook names? |
|
144 | 144 | """ |
|
145 | 145 | with self.create_temp_cwd(['notebook*.ipynb']): |
|
146 |
self. |
|
|
146 | self.nbconvert('--log-level 0 --to python ' | |
|
147 | 147 | '*.ipynb notebook1.ipynb notebook2.ipynb') |
|
148 | 148 | assert os.path.isfile('notebook1.py') |
|
149 | 149 | assert os.path.isfile('notebook2.py') |
@@ -154,7 +154,7 b' class TestNbConvertApp(TestsBase):' | |||
|
154 | 154 | Can explicit notebook names be used and then a matching search pattern? |
|
155 | 155 | """ |
|
156 | 156 | with self.create_temp_cwd(['notebook*.ipynb']): |
|
157 |
self. |
|
|
157 | self.nbconvert('--log-level 0 --to=python ' | |
|
158 | 158 | 'notebook1.ipynb notebook2.ipynb *.ipynb') |
|
159 | 159 | assert os.path.isfile('notebook1.py') |
|
160 | 160 | assert os.path.isfile('notebook2.py') |
@@ -165,7 +165,7 b' class TestNbConvertApp(TestsBase):' | |||
|
165 | 165 | Does the default config work? |
|
166 | 166 | """ |
|
167 | 167 | with self.create_temp_cwd(['notebook*.ipynb', 'ipython_nbconvert_config.py']): |
|
168 |
self. |
|
|
168 | self.nbconvert('--log-level 0') | |
|
169 | 169 | assert os.path.isfile('notebook1.py') |
|
170 | 170 | assert not os.path.isfile('notebook2.py') |
|
171 | 171 | |
@@ -177,7 +177,7 b' class TestNbConvertApp(TestsBase):' | |||
|
177 | 177 | with self.create_temp_cwd(['notebook*.ipynb', |
|
178 | 178 | 'ipython_nbconvert_config.py', |
|
179 | 179 | 'override.py']): |
|
180 |
self. |
|
|
180 | self.nbconvert('--log-level 0 --config="override.py"') | |
|
181 | 181 | assert not os.path.isfile('notebook1.py') |
|
182 | 182 | assert os.path.isfile('notebook2.py') |
|
183 | 183 | |
@@ -187,7 +187,7 b' class TestNbConvertApp(TestsBase):' | |||
|
187 | 187 | """ |
|
188 | 188 | with self.create_temp_cwd(): |
|
189 | 189 | self.create_empty_notebook(u'nb1_análisis.ipynb') |
|
190 |
self. |
|
|
190 | self.nbconvert('--log-level 0 --to python nb1_*') | |
|
191 | 191 | assert os.path.isfile(u'nb1_análisis.py') |
|
192 | 192 | |
|
193 | 193 | @dec.onlyif_cmds_exist('pdflatex', 'pandoc') |
@@ -197,7 +197,7 b' class TestNbConvertApp(TestsBase):' | |||
|
197 | 197 | """ |
|
198 | 198 | with self.create_temp_cwd(): |
|
199 | 199 | self.create_empty_notebook(u'nb1_análisis.ipynb') |
|
200 |
self. |
|
|
200 | self.nbconvert('--log-level 0 --to pdf "nb1_*"' | |
|
201 | 201 | ' --PDFExporter.latex_count=1' |
|
202 | 202 | ' --PDFExporter.verbose=True') |
|
203 | 203 | assert os.path.isfile(u'nb1_análisis.pdf') |
@@ -208,7 +208,7 b' class TestNbConvertApp(TestsBase):' | |||
|
208 | 208 | """ |
|
209 | 209 | with self.create_temp_cwd(['hello.py']): |
|
210 | 210 | self.create_empty_notebook(u'empty.ipynb') |
|
211 |
self. |
|
|
211 | self.nbconvert('empty --to html --NbConvertApp.writer_class=\'hello.HelloWriter\'') | |
|
212 | 212 | assert os.path.isfile(u'hello.txt') |
|
213 | 213 | |
|
214 | 214 | def test_output_suffix(self): |
@@ -217,7 +217,7 b' class TestNbConvertApp(TestsBase):' | |||
|
217 | 217 | """ |
|
218 | 218 | with self.create_temp_cwd(): |
|
219 | 219 | self.create_empty_notebook('empty.ipynb') |
|
220 |
self. |
|
|
220 | self.nbconvert('empty.ipynb --to notebook') | |
|
221 | 221 | assert os.path.isfile('empty.nbconvert.ipynb') |
|
222 | 222 | |
|
223 | 223 | def test_different_build_dir(self): |
@@ -227,8 +227,8 b' class TestNbConvertApp(TestsBase):' | |||
|
227 | 227 | with self.create_temp_cwd(): |
|
228 | 228 | self.create_empty_notebook('empty.ipynb') |
|
229 | 229 | os.mkdir('output') |
|
230 |
self. |
|
|
231 |
' |
|
|
230 | self.nbconvert( | |
|
231 | 'empty.ipynb --to notebook ' | |
|
232 | 232 | '--FilesWriter.build_directory=output') |
|
233 | 233 | assert os.path.isfile('output/empty.ipynb') |
|
234 | 234 | |
@@ -238,6 +238,6 b' class TestNbConvertApp(TestsBase):' | |||
|
238 | 238 | """ |
|
239 | 239 | with self.create_temp_cwd(): |
|
240 | 240 | self.create_empty_notebook('empty.ipynb') |
|
241 |
self. |
|
|
241 | self.nbconvert('empty.ipynb --to notebook --inplace') | |
|
242 | 242 | assert os.path.isfile('empty.ipynb') |
|
243 | 243 | assert not os.path.isfile('empty.nbconvert.ipynb') |
@@ -1,27 +1,15 b'' | |||
|
1 | 1 | """Test QtConsoleApp""" |
|
2 | 2 | |
|
3 | #----------------------------------------------------------------------------- | |
|
4 | # Copyright (C) 2013 The IPython Development Team | |
|
5 | # | |
|
6 | # Distributed under the terms of the BSD License. The full license is in | |
|
7 | # the file COPYING, distributed as part of this software. | |
|
8 | #----------------------------------------------------------------------------- | |
|
9 | ||
|
10 | #----------------------------------------------------------------------------- | |
|
11 | # Imports | |
|
12 | #----------------------------------------------------------------------------- | |
|
3 | # Copyright (c) Jupyter Development Team. | |
|
4 | # Distributed under the terms of the Modified BSD License. | |
|
13 | 5 | |
|
14 | 6 | import nose.tools as nt |
|
15 | 7 | |
|
16 | import IPython.testing.tools as tt | |
|
8 | from traitlets.tests.utils import check_help_all_output | |
|
17 | 9 | from IPython.testing.decorators import skip_if_no_x11 |
|
18 | 10 | |
|
19 | #----------------------------------------------------------------------------- | |
|
20 | # Test functions | |
|
21 | #----------------------------------------------------------------------------- | |
|
22 | ||
|
23 | 11 | @skip_if_no_x11 |
|
24 | 12 | def test_help_output(): |
|
25 |
""" |
|
|
26 |
|
|
|
13 | """jupyter qtconsole --help-all works""" | |
|
14 | check_help_all_output('jupyter_qtconsole') | |
|
27 | 15 |
General Comments 0
You need to be logged in to leave comments.
Login now