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