Skip to content

Commit

Permalink
add test for old behaviour where kernel_name="" uses file specified
Browse files Browse the repository at this point in the history
In order to not use the default "python" behvaiour, I set the kernel to 
be "python3". However, that means this can only work if we have a 
python3 kernel available.
  • Loading branch information
mpacer committed Sep 11, 2018
1 parent f39ec9d commit 719a887
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nbconvert/preprocessors/tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from .base import PreprocessorTestsBase
from ..execute import ExecutePreprocessor, CellExecutionError, executenb, find_kernel_name

from jupyter_client.kernelspec import KernelSpecManager

from nbconvert.filters import strip_ansi
from testpath import modified_env
from ipython_genutils.py3compat import string_types
Expand Down Expand Up @@ -151,6 +153,19 @@ def test_empty_path(self):
res['metadata']['path'] = ''
input_nb, output_nb = self.run_notebook(filename, {}, res)
self.assert_notebooks_equal(input_nb, output_nb)

@pytest.mark.xfail("python3" not in KernelSpecManager().find_kernel_specs(),
reason="requires a python3 kernelspec")
def test_empty_kernel_name(self):
"""Can kernel in nb metadata be found when an empty string is passed?
Note: this pattern should be discouraged in practice.
Passing in no kernel_name to ExecutePreprocessor is preferable.
"""
filename = os.path.join(current_dir, 'files', 'UnicodePy3.ipynb')
res = self.build_resources()
input_nb, output_nb = self.run_notebook(filename, {"kernel_name": ""}, res)
self.assert_notebooks_equal(input_nb, output_nb)

def test_disable_stdin(self):
"""Test disabling standard input"""
Expand Down

0 comments on commit 719a887

Please sign in to comment.