iiasa / ixmp

The ix modeling platform for integrated and cross-cutting scenario analysis
https://docs.messageix.org/ixmp
Apache License 2.0
38 stars 112 forks source link

Use nbclient instead in ixmp.testing.run_notebook() #371

Closed khaeru closed 4 years ago

khaeru commented 4 years ago

run_notebook() used the built-in Python subprocess module to run tutorial and test notebooks, write the results to a file, and then read the finished notebook. This process recently began to cause test & CI failures, e.g. in #370.

The Jupyter ecosystem now has a first-class package nbclient that executes notebooks programmatically; this PR:

How to review

PR checklist

codecov[bot] commented 4 years ago

Codecov Report

Merging #371 into master will decrease coverage by 0.0%. The diff coverage is 100.0%.

@@           Coverage Diff            @@
##           master    #371     +/-   ##
========================================
- Coverage    96.8%   96.8%   -0.1%     
========================================
  Files          46      46             
  Lines        5255    5253      -2     
========================================
- Hits         5088    5086      -2     
  Misses        167     167             
Impacted Files Coverage Δ
ixmp/testing.py 78.2% <100.0%> (-0.2%) :arrow_down:
khaeru commented 4 years ago

It was necessary to work around jupyter/nbclient#85; this was done according to https://github.com/jupyter/nbconvert/issues/1372#issuecomment-691596163. The workaround should be removed once that issue is fixed in a version of nbclient ≥ 0.5.1.