##// END OF EJS Templates
don't use utils.process in nbconvert...
Min RK -
Show More
@@ -23,7 +23,6 b' except ImportError as e:'
23
23
24 from jupyter_nbconvert.utils.pandoc import pandoc
24 from jupyter_nbconvert.utils.pandoc import pandoc
25 from jupyter_nbconvert.utils.exceptions import ConversionException
25 from jupyter_nbconvert.utils.exceptions import ConversionException
26 from IPython.utils.process import get_output_error_code
27 from IPython.utils.py3compat import cast_bytes
26 from IPython.utils.py3compat import cast_bytes
28 from IPython.utils.version import check_version
27 from IPython.utils.version import check_version
29
28
@@ -130,11 +129,14 b' def _verify_node(cmd):'
130 cmd : string
129 cmd : string
131 Node command to verify (i.e 'node')."""
130 Node command to verify (i.e 'node')."""
132 try:
131 try:
133 out, err, return_code = get_output_error_code([cmd, '--version'])
132 p = subprocess.Popen([cmd, '--version'],
133 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
134 out, _ = p.communicate()
135 out = out.decode('utf8', 'replace')
134 except OSError:
136 except OSError:
135 # Command not found
137 # Command not found
136 return False
138 return False
137 if return_code:
139 if p.returncode:
138 # Command error
140 # Command error
139 return False
141 return False
140 return check_version(out.lstrip('v'), '0.9.12')
142 return check_version(out.lstrip('v'), '0.9.12')
@@ -10,13 +10,14 b' import shlex'
10 import shutil
10 import shutil
11 import sys
11 import sys
12 import unittest
12 import unittest
13 from subprocess import Popen, PIPE
13
14
14 import nose.tools as nt
15 import nose.tools as nt
15
16
16 from IPython.nbformat import v4, write
17 from IPython.nbformat import v4, write
17 from IPython.utils.tempdir import TemporaryWorkingDirectory
18 from IPython.utils.tempdir import TemporaryWorkingDirectory
18 from IPython.utils.process import get_output_error_code
19
19 from IPython.utils.py3compat import string_types
20 from IPython.utils.py3compat import string_types, bytes_to_str
20
21
21 class TestsBase(unittest.TestCase):
22 class TestsBase(unittest.TestCase):
22 """Base tests class. Contains useful fuzzy comparison and nbconvert
23 """Base tests class. Contains useful fuzzy comparison and nbconvert
@@ -141,11 +142,13 b' class TestsBase(unittest.TestCase):'
141 if isinstance(parameters, string_types):
142 if isinstance(parameters, string_types):
142 parameters = shlex.split(parameters)
143 parameters = shlex.split(parameters)
143 cmd = [sys.executable, '-m', 'jupyter_nbconvert'] + parameters
144 cmd = [sys.executable, '-m', 'jupyter_nbconvert'] + parameters
144 stdout, stderr, retcode = get_output_error_code(cmd)
145 p = Popen(cmd, stdout=PIPE, stderr=PIPE)
145 if not (retcode == 0 or ignore_return_code):
146 stdout, stderr = p.communicate()
146 raise OSError(stderr)
147 if not (p.returncode == 0 or ignore_return_code):
147 return stdout, stderr
148 raise OSError(bytes_to_str(stderr))
148
149 return stdout.decode('utf8', 'replace'), stderr.decode('utf8', 'replace')
150
151
149 def assert_big_text_equal(a, b, chunk_size=80):
152 def assert_big_text_equal(a, b, chunk_size=80):
150 """assert that large strings are equal
153 """assert that large strings are equal
151
154
@@ -11,7 +11,7 b' from io import TextIOWrapper, BytesIO'
11
11
12 from IPython.utils.py3compat import cast_bytes
12 from IPython.utils.py3compat import cast_bytes
13 from IPython.utils.version import check_version
13 from IPython.utils.version import check_version
14 from IPython.utils.process import is_cmd_found, FindCmdError
14 from IPython.utils.py3compat import which
15
15
16 from .exceptions import ConversionException
16 from .exceptions import ConversionException
17
17
@@ -71,7 +71,7 b' def get_pandoc_version():'
71 global __version
71 global __version
72
72
73 if __version is None:
73 if __version is None:
74 if not is_cmd_found('pandoc'):
74 if not which('pandoc'):
75 raise PandocMissing()
75 raise PandocMissing()
76
76
77 out = subprocess.check_output(['pandoc', '-v'],
77 out = subprocess.check_output(['pandoc', '-v'],
General Comments 0
You need to be logged in to leave comments. Login now