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