##// END OF EJS Templates
remove PDF post processor
MinRK -
Show More
@@ -0,0 +1,36 b''
1 """Tests for PDF export"""
2
3 # Copyright (c) IPython Development Team.
4 # Distributed under the terms of the Modified BSD License.
5
6 import logging
7 import os
8
9 from IPython.testing import decorators as dec
10
11 from .base import ExportersTestsBase
12 from ..pdf import PDFExporter
13
14
15 #-----------------------------------------------------------------------------
16 # Class
17 #-----------------------------------------------------------------------------
18
19 class TestPDF(ExportersTestsBase):
20 """Test PDF export"""
21
22 exporter_class = PDFExporter
23
24 def test_constructor(self):
25 """Can a PDFExporter be constructed?"""
26 self.exporter_class()
27
28
29 @dec.onlyif_cmds_exist('pdflatex')
30 @dec.onlyif_cmds_exist('pandoc')
31 def test_export(self):
32 """Smoke test PDFExporter"""
33 (output, resources) = self.exporter_class(latex_count=1).from_filename(self._get_notebook())
34 self.assertIsInstance(output, bytes)
35 assert len(output) > 0
36
@@ -164,8 +164,7 b' class NbConvertApp(BaseIPythonApplication):'
164 164 postprocessor_class = DottedOrNone(config=True,
165 165 help="""PostProcessor class used to write the
166 166 results of the conversion""")
167 postprocessor_aliases = {'pdf': 'IPython.nbconvert.postprocessors.pdf.PDFPostProcessor',
168 'serve': 'IPython.nbconvert.postprocessors.serve.ServePostProcessor'}
167 postprocessor_aliases = {'serve': 'IPython.nbconvert.postprocessors.serve.ServePostProcessor'}
169 168 postprocessor_factory = Type()
170 169
171 170 def _postprocessor_class_changed(self, name, old, new):
@@ -1,5 +1,4 b''
1 1 from .base import PostProcessorBase
2 from .pdf import PDFPostProcessor
3 2
4 3 # protect against unavailable tornado
5 4 try:
@@ -1,22 +1,15 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Test NbConvertApp"""
3 3
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2013 The IPython Development Team
6 #
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
14 6
15 7 import os
16 8 import glob
17 9 import sys
18 10
19 11 from .base import TestsBase
12 from ..postprocessors import PostProcessorBase
20 13
21 14 import IPython.testing.tools as tt
22 15 from IPython.testing import decorators as dec
@@ -25,6 +18,10 b' from IPython.testing import decorators as dec'
25 18 # Classes and functions
26 19 #-----------------------------------------------------------------------------
27 20
21 class DummyPost(PostProcessorBase):
22 def postprocess(self, filename):
23 print("Dummy:%s" % filename)
24
28 25 class TestNbConvertApp(TestsBase):
29 26 """Collection of NbConvertApp tests"""
30 27
@@ -79,24 +76,19 b' class TestNbConvertApp(TestsBase):'
79 76 """
80 77 with self.create_temp_cwd(['notebook2.ipynb']):
81 78 os.rename('notebook2.ipynb', 'notebook with spaces.ipynb')
82 self.call('nbconvert --log-level 0 --to latex '
83 '"notebook with spaces" --post PDF '
84 '--PDFPostProcessor.verbose=True')
85 assert os.path.isfile('notebook with spaces.tex')
86 assert os.path.isdir('notebook with spaces_files')
79 self.call('nbconvert --log-level 0 --to pdf'
80 ' "notebook with spaces"'
81 ' --PDFExporter.latex_count=1'
82 ' --PDFExporter.verbose=True'
83 )
87 84 assert os.path.isfile('notebook with spaces.pdf')
88 85
89 @dec.onlyif_cmds_exist('pdflatex')
90 @dec.onlyif_cmds_exist('pandoc')
91 86 def test_post_processor(self):
92 """
93 Do post processors work?
94 """
87 """Do post processors work?"""
95 88 with self.create_temp_cwd(['notebook1.ipynb']):
96 self.call('nbconvert --log-level 0 --to latex notebook1 '
97 '--post PDF --PDFPostProcessor.verbose=True')
98 assert os.path.isfile('notebook1.tex')
99 assert os.path.isfile('notebook1.pdf')
89 out, err = self.call('nbconvert --log-level 0 --to python notebook1 '
90 '--post IPython.nbconvert.tests.test_nbconvertapp.DummyPost')
91 self.assertIn('Dummy:notebook1.py', out)
100 92
101 93 @dec.onlyif_cmds_exist('pandoc')
102 94 def test_spurious_cr(self):
@@ -195,8 +187,7 b' class TestNbConvertApp(TestsBase):'
195 187 """
196 188 with self.create_temp_cwd():
197 189 self.create_empty_notebook(u'nb1_análisis.ipynb')
198 self.call('nbconvert --log-level 0 --to latex '
199 '"nb1_*" --post PDF '
200 '--PDFPostProcessor.verbose=True')
201 assert os.path.isfile(u'nb1_análisis.tex')
190 self.call('nbconvert --log-level 0 --to pdf "nb1_*"'
191 ' --PDFExporter.latex_count=1'
192 ' --PDFExporter.verbose=True')
202 193 assert os.path.isfile(u'nb1_análisis.pdf')
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now