File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ matplotlib-base = ">=3.9"
33
33
ipympl = " >=0.9"
34
34
jupyterlab = " >=4.2"
35
35
jupyterlab-myst = " >=2.4"
36
+ pytest = " >=8.3.5,<9"
37
+ nbval = " >=0.11.0,<0.12"
36
38
37
39
[pypi-dependencies ]
38
40
sphinx = " >=8.0.2"
Original file line number Diff line number Diff line change
1
+ [pytest]
2
+ norecursedirs = _build
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Collect converted ipynb files to clean up at the end.
4
+ notebook_files=()
5
+
6
+ # Find Markdown files convert.
7
+ all_markdown_files=$( find tutorials -type f -name " *.md" )
8
+ if [ $# -gt 0 ]; then
9
+ files_to_process=" $@ "
10
+ else
11
+ files_to_process=$all_markdown_files
12
+ fi
13
+
14
+ # Identify Markdown files that are Jupytext and convert them all.
15
+ for file in ${files_to_process} ; do
16
+ echo loop in $file
17
+ # Extract the kernel information from the Jupytext Markdown file.
18
+ kernel_info=$( grep -A 10 ' ^---$' " $file " | grep -E ' kernelspec' )
19
+ # Skip if no kernel information was found.
20
+ if [ -z " $kernel_info " ]; then
21
+ continue
22
+ fi
23
+ # Convert to ipynb format, to be consumed by pytest nbval plugin.
24
+ jupytext --to ipynb " $file "
25
+ notebook_file=" ${file% .md} .ipynb"
26
+ # Stash file in array to be cleaned up at the end.
27
+ notebook_files+=(" ${notebook_file} " )
28
+ done
29
+
30
+ pytest --nbval-lax
31
+
32
+ # Clean up ipynb files that were converted. Any stray ipynb files that were
33
+ # _not_ the result of conversion from Markdown will be left alone.
34
+ for file in " ${notebook_files[@]} " ; do
35
+ rm -v " $file "
36
+ done
You can’t perform that action at this time.
0 commit comments