Show More
@@ -1,63 +1,64 b'' | |||||
1 | """ |
|
1 | """ | |
2 | Module with tests for the PDF post-processor |
|
2 | Module with tests for the PDF post-processor | |
3 | """ |
|
3 | """ | |
4 |
|
4 | |||
5 | #----------------------------------------------------------------------------- |
|
5 | #----------------------------------------------------------------------------- | |
6 | # Copyright (c) 2013, the IPython Development Team. |
|
6 | # Copyright (c) 2013, the IPython Development Team. | |
7 | # |
|
7 | # | |
8 | # Distributed under the terms of the Modified BSD License. |
|
8 | # Distributed under the terms of the Modified BSD License. | |
9 | # |
|
9 | # | |
10 | # The full license is in the file COPYING.txt, distributed with this software. |
|
10 | # The full license is in the file COPYING.txt, distributed with this software. | |
11 | #----------------------------------------------------------------------------- |
|
11 | #----------------------------------------------------------------------------- | |
12 |
|
12 | |||
13 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | import os |
|
17 | import os | |
18 |
|
18 | |||
19 | from IPython.testing import decorators as dec |
|
19 | from IPython.testing import decorators as dec | |
20 |
|
20 | |||
21 | from ...tests.base import TestsBase |
|
21 | from ...tests.base import TestsBase | |
22 | from ..pdf import PDFPostProcessor |
|
22 | from ..pdf import PDFPostProcessor | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | #----------------------------------------------------------------------------- |
|
25 | #----------------------------------------------------------------------------- | |
26 | # Constants |
|
26 | # Constants | |
27 | #----------------------------------------------------------------------------- |
|
27 | #----------------------------------------------------------------------------- | |
28 |
|
28 | |||
29 | HELLO_WORLD = r"""% hello.tex - Our first LaTeX example! |
|
29 | HELLO_WORLD = r"""% hello.tex - Our first LaTeX example! | |
30 | \documentclass{article} |
|
30 | \documentclass{article} | |
31 | \begin{document} |
|
31 | \begin{document} | |
32 | Hello World! |
|
32 | Hello World! | |
33 | \end{document}""" |
|
33 | \end{document}""" | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | #----------------------------------------------------------------------------- |
|
36 | #----------------------------------------------------------------------------- | |
37 | # Class |
|
37 | # Class | |
38 | #----------------------------------------------------------------------------- |
|
38 | #----------------------------------------------------------------------------- | |
39 |
|
39 | |||
40 | class TestPDF(TestsBase): |
|
40 | class TestPDF(TestsBase): | |
41 | """Contains test functions for pdf.py""" |
|
41 | """Contains test functions for pdf.py""" | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | def test_constructor(): |
|
44 | def test_constructor(self): | |
45 | """Can a PDFPostProcessor be constructed?""" |
|
45 | """Can a PDFPostProcessor be constructed?""" | |
46 | PDFPostProcessor() |
|
46 | PDFPostProcessor() | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | @dec.onlyif_cmds_exist('pdflatex') |
|
49 | @dec.onlyif_cmds_exist('pdflatex') | |
50 | def test_pdf(): |
|
50 | def test_pdf(self): | |
51 | """Can a PDF be made using the PDFPostProcessor?""" |
|
51 | """Can a PDF be made using the PDFPostProcessor?""" | |
52 |
|
52 | |||
53 | # Work in a temporary directory with hello world latex in it. |
|
53 | # Work in a temporary directory with hello world latex in it. | |
54 | with self.create_temp_cwd() |
|
54 | with self.create_temp_cwd(): | |
55 | with open('a.tex', 'w') as f: |
|
55 | with open('a.tex', 'w') as f: | |
56 | f.write(HELLO_WORLD) |
|
56 | f.write(HELLO_WORLD) | |
57 |
|
57 | |||
58 | # Construct post-processor |
|
58 | # Construct post-processor | |
59 | processor = PDFPostProcessor() |
|
59 | processor = PDFPostProcessor() | |
|
60 | processor.verbose = False | |||
60 | processor('a.tex') |
|
61 | processor('a.tex') | |
61 |
|
62 | |||
62 | # Check that the PDF was created. |
|
63 | # Check that the PDF was created. | |
63 | assert os.path.isfile('a.pdf') |
|
64 | assert os.path.isfile('a.pdf') |
@@ -1,31 +1,31 b'' | |||||
1 | """ |
|
1 | """ | |
2 | Module with tests for the serve post-processor |
|
2 | Module with tests for the serve post-processor | |
3 | """ |
|
3 | """ | |
4 |
|
4 | |||
5 | #----------------------------------------------------------------------------- |
|
5 | #----------------------------------------------------------------------------- | |
6 | # Copyright (c) 2013, the IPython Development Team. |
|
6 | # Copyright (c) 2013, the IPython Development Team. | |
7 | # |
|
7 | # | |
8 | # Distributed under the terms of the Modified BSD License. |
|
8 | # Distributed under the terms of the Modified BSD License. | |
9 | # |
|
9 | # | |
10 | # The full license is in the file COPYING.txt, distributed with this software. |
|
10 | # The full license is in the file COPYING.txt, distributed with this software. | |
11 | #----------------------------------------------------------------------------- |
|
11 | #----------------------------------------------------------------------------- | |
12 |
|
12 | |||
13 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | from ...tests.base import TestsBase |
|
17 | from ...tests.base import TestsBase | |
18 | from ..serve import ServePostProcessor |
|
18 | from ..serve import ServePostProcessor | |
19 |
|
19 | |||
20 |
|
20 | |||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | # Class |
|
22 | # Class | |
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
24 |
|
24 | |||
25 | class TestServe(TestsBase): |
|
25 | class TestServe(TestsBase): | |
26 | """Contains test functions for serve.py""" |
|
26 | """Contains test functions for serve.py""" | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | def test_constructor(): |
|
29 | def test_constructor(self): | |
30 | """Can a ServePostProcessor be constructed?""" |
|
30 | """Can a ServePostProcessor be constructed?""" | |
31 | ServePostProcessor() |
|
31 | ServePostProcessor() |
General Comments 0
You need to be logged in to leave comments.
Login now