forked from ipython/ipython
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PDF and Serve post-processor tests
- Loading branch information
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
""" | ||
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(): | ||
"""Can a PDFPostProcessor be constructed?""" | ||
PDFPostProcessor() | ||
|
||
|
||
@dec.onlyif_cmds_exist('pdflatex') | ||
def test_pdf(): | ||
"""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('a.tex') | ||
|
||
# Check that the PDF was created. | ||
assert os.path.isfile('a.pdf') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(): | ||
"""Can a ServePostProcessor be constructed?""" | ||
ServePostProcessor() |