Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbconvert: Post-processor tests #3933

Merged
merged 2 commits into from
Aug 10, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Empty file.
64 changes: 64 additions & 0 deletions IPython/nbconvert/post_processors/tests/test_pdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""
Module with tests for the PDF post-processor
"""

#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

import os

from IPython.testing import decorators as dec

from ...tests.base import TestsBase
from ..pdf import PDFPostProcessor


#-----------------------------------------------------------------------------
# Constants
#-----------------------------------------------------------------------------

HELLO_WORLD = r"""% hello.tex - Our first LaTeX example!
\documentclass{article}
\begin{document}
Hello World!
\end{document}"""


#-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------

class TestPDF(TestsBase):
"""Contains test functions for pdf.py"""


def test_constructor(self):
"""Can a PDFPostProcessor be constructed?"""
PDFPostProcessor()


@dec.onlyif_cmds_exist('pdflatex')
def test_pdf(self):
"""Can a PDF be made using the PDFPostProcessor?"""

# Work in a temporary directory with hello world latex in it.
with self.create_temp_cwd():
with open('a.tex', 'w') as f:
f.write(HELLO_WORLD)

# Construct post-processor
processor = PDFPostProcessor()
processor.verbose = False
processor('a.tex')

# Check that the PDF was created.
assert os.path.isfile('a.pdf')
31 changes: 31 additions & 0 deletions IPython/nbconvert/post_processors/tests/test_serve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
Module with tests for the serve post-processor
"""

#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

from ...tests.base import TestsBase
from ..serve import ServePostProcessor


#-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------

class TestServe(TestsBase):
"""Contains test functions for serve.py"""


def test_constructor(self):
"""Can a ServePostProcessor be constructed?"""
ServePostProcessor()