1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-14 15:32:29 +00:00
soil/tests/test_ipython.py
J. Fernando Sánchez 55bbc76b2a Improve tutorial
* Improve text
* Move to docs
* Autogenerate with sphinx
* Fix naming issue `environment.run` (double name)
* Add to tests
2023-04-24 18:47:52 +02:00

19 lines
659 B
Python

from unittest import TestCase
import os
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
ROOT = os.path.abspath(os.path.dirname(__file__))
class TestNotebooks(TestCase):
def test_tutorial(self):
notebook = os.path.join(ROOT, "../docs/tutorial/soil_tutorial.ipynb")
with open(notebook) as f:
nb = nbformat.read(f, as_version=4)
ep = ExecutePreprocessor(timeout=60000, kernel_name='python3')
try:
assert ep.preprocess(nb) is not None, f"Got empty notebook for {notebook}"
except Exception:
assert False, f"Failed executing {notebook}"