chrisjsewell / ipypublish
1 3
import os
2 3
import pytest
3

4

5 3
@pytest.mark.requires_latexmk
6 3
@pytest.mark.ipynb("nb_markdown_cells")
7 3
def test_latex_and_pdf(ipynb_app):
8 3
    ipynb_app.run(
9
        {
10
            "conversion": "latex_ipypublish_main",
11
            "default_pporder_kwargs": {"create_pdf": True},
12
        }
13
    )
14 3
    ipynb_app.assert_converted_exists()
15 3
    ipynb_app.assert_converted_exists(extension=".pdf")
16
    # Table format has changed through the versions
17 3
    if ipynb_app.pandoc_version < "2.2":
18 0
        raise AssertionError("pandoc version must be >= 2.2")
19 3
    ipynb_app.assert_converted_equals_expected("latex_ipypublish_main.pandoc.2-2")
20

21

22 3
@pytest.mark.skipif(os.name == "nt", reason="skipping")
23 3
@pytest.mark.ipynb("nb_markdown_cells")
24 3
def test_sphinx_rst(ipynb_app):
25 3
    ipynb_app.run({"conversion": "sphinx_ipypublish_main"})
26 3
    ipynb_app.assert_converted_exists()
27
    # Table format has changed through the versions
28 3
    if ipynb_app.pandoc_version < "2.6":
29 0
        raise AssertionError("pandoc version must be >= 2.6")
30 3
    ipynb_app.assert_converted_equals_expected("sphinx_ipypublish_main.pandoc.2-6")
31

32

33 3
@pytest.mark.skipif(os.name == "nt", reason="skipping")
34 3
@pytest.mark.ipynb("nb_with_mkdown_images")  # out_to_temp=False
35 3
def test_sphinx_rst_with_mkdown_images(ipynb_app):
36
    """ test a notebook with multiple images """
37 3
    ipynb_app.run(
38
        {
39
            "conversion": "sphinx_ipypublish_main.run",
40
            "log_to_file": True,
41
            "default_pporder_kwargs": {"dump_files": True},
42
        }
43
    )
44 3
    ipynb_app.assert_converted_exists()
45 3
    ipynb_app.assert_converted_equals_expected("sphinx_ipypublish_main")
46 3
    assert ipynb_app.converted_path.joinpath("main_files/example.jpg").is_file()

Read our documentation on viewing source code .

Loading