Skip to content

Commit d9a65e9

Browse files
authored
Merge pull request #411 from zivy/nbconvert
Address change in nbconvert behavior.
2 parents 3ccfe9d + 60c94de commit d9a65e9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_notebooks.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,11 @@ def dynamic_analysis(self, path, kernel_name):
318318

319319
# Execute the notebook and allow errors (run all cells), output is
320320
# written to a temporary file which is automatically deleted.
321-
# The delete=False is here to address an issue that Windows that seems to have with temporary files (see https://bugs.python.org/issue14243).
321+
# The delete=False is here to address an issue that Windows has with temporary files.
322+
# On windows, if delete=True the file is kept open and cannot be read from.
323+
# (see https://github.com/python/cpython/issues/58451).
322324
with tempfile.NamedTemporaryFile(suffix=".ipynb", delete=False) as fout:
325+
output_dir, output_fname = os.path.split(fout.name)
323326
args = [
324327
"jupyter",
325328
"nbconvert",
@@ -329,8 +332,10 @@ def dynamic_analysis(self, path, kernel_name):
329332
"--ExecutePreprocessor.kernel_name=" + kernel_name,
330333
"--ExecutePreprocessor.allow_errors=True",
331334
"--ExecutePreprocessor.timeout=6000", # seconds till timeout
335+
"--output-dir",
336+
output_dir,
332337
"--output",
333-
fout.name,
338+
output_fname,
334339
path,
335340
]
336341
subprocess.check_call(args)

0 commit comments

Comments
 (0)