From 8a9548019ef215f93b839fe852549c4d508fb2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Fri, 8 Nov 2024 18:16:15 -0500 Subject: [PATCH] ENH: Add additional step to `tox` to run notebooks Add an additional step to `tox` to run notebooks. Add `nbconvert` and `nbclient` to the dependencies of the `test` table in `pyproject.toml` so that the notebooks can be run. --- pyproject.toml | 2 ++ tox.ini | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8bed5680..d69482a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,6 +68,8 @@ resmon = ["psutil >=5.4"] test = [ "coverage", + "nbconvert", + "nbclient", "pytest >= 4.4", "pytest-cov", "pytest-env", diff --git a/tox.ini b/tox.ini index 76398f37..eac1eeb4 100644 --- a/tox.ini +++ b/tox.ini @@ -38,6 +38,33 @@ commands = pytest --doctest-modules --cov eddymotion -n auto --cov-report xml \ --junitxml=test-results.xml -v src test {posargs} +[testenv:notebooks] +description = Run notebooks +labels = notebooks +pass_env = + # getpass.getuser() sources for Windows: + LOGNAME + USER + LNAME + USERNAME + # Pass user color preferences through + PY_COLORS + FORCE_COLOR + NO_COLOR + CLICOLOR + CLICOLOR_FORCE + CURBRANCH + GITHUB_ACTIONS + TEST_DATA_HOME + TEST_OUTPUT_DIR + TEST_WORK_DIR + PYTHONHASHSEED + ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS + PATH +extras = test +commands = + python -m nbconvert --to notebook --ExecutePreprocessor.kernel_name=python3 --execute docs/notebooks/* + [testenv:docs] description = Build documentation site labels = docs