Skip to content

Commit 0a87f84

Browse files
committed
Run converted notebook with ipython if nb uses magic
1 parent ba75940 commit 0a87f84

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

run-tests.py

+5
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ def test_notebook(path, executable="python"):
188188
env = dict(os.environ)
189189
env["MPLBACKEND"] = "Template"
190190

191+
# If notebook makes use of magic commands then
192+
# the script must be ran using ipython
193+
# https://github.com/jupyter/nbconvert/issues/503#issuecomment-269527834
194+
executable = "ipython" if ("run_cell_magic(" in code) else executable
195+
191196
# Run in subprocess
192197
cmd = [executable] + ["-c", code]
193198
try:

0 commit comments

Comments
 (0)