Show More
@@ -10,6 +10,7 b'' | |||
|
10 | 10 | # Imports |
|
11 | 11 | #----------------------------------------------------------------------------- |
|
12 | 12 | import os |
|
13 | import warnings | |
|
13 | 14 | |
|
14 | 15 | from IPython.testing import decorators as dec |
|
15 | 16 | |
@@ -32,22 +33,29 b' class TestPandoc(TestsBase):' | |||
|
32 | 33 | pandoc.clean_cache() |
|
33 | 34 | |
|
34 | 35 | os.environ["PATH"] = "" |
|
35 | assert pandoc_function_raised_missing(pandoc.get_pandoc_version) == True | |
|
36 | assert pandoc_function_raised_missing(pandoc.check_pandoc_version) == True | |
|
37 | assert pandoc_function_raised_missing(pandoc.pandoc, "", "markdown", "html") == True | |
|
36 | with self.assertRaises(pandoc.PandocMissing): | |
|
37 | pandoc.get_pandoc_version() | |
|
38 | with self.assertRaises(pandoc.PandocMissing): | |
|
39 | pandoc.check_pandoc_version() | |
|
40 | with self.assertRaises(pandoc.PandocMissing): | |
|
41 | pandoc.pandoc("", "markdown", "html") | |
|
38 | 42 | |
|
39 | 43 | # original_env["PATH"] should contain pandoc |
|
40 | 44 | os.environ["PATH"] = self.original_env["PATH"] |
|
41 | assert pandoc_function_raised_missing(pandoc.get_pandoc_version) == False | |
|
42 | assert pandoc_function_raised_missing(pandoc.check_pandoc_version) == False | |
|
43 | assert pandoc_function_raised_missing(pandoc.pandoc, "", "markdown", "html") == False | |
|
45 | with warnings.catch_warnings(True) as w: | |
|
46 | pandoc.get_pandoc_version() | |
|
47 | pandoc.check_pandoc_version() | |
|
48 | pandoc.pandoc("", "markdown", "html") | |
|
49 | self.assertEqual(w, []) | |
|
44 | 50 | |
|
45 | 51 | @dec.onlyif_cmds_exist('pandoc') |
|
46 | 52 | def test_minimal_version(self): |
|
47 | 53 | original_minversion = pandoc._minimal_version |
|
48 | 54 | |
|
49 | 55 | pandoc._minimal_version = "120.0" |
|
56 | with warnings.catch_warnings(True) as w: | |
|
50 | 57 | assert not pandoc.check_pandoc_version() |
|
58 | self.assertEqual(len(w), 1) | |
|
51 | 59 | |
|
52 | 60 | pandoc._minimal_version = pandoc.get_pandoc_version() |
|
53 | 61 | assert pandoc.check_pandoc_version() |
General Comments 0
You need to be logged in to leave comments.
Login now