Skip to content

Commit 7695e14

Browse files
committed
CI: Add docstring testing
1 parent 5646a50 commit 7695e14

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/workflows/doc_checks.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
. doc_env/bin/activate
3737
python3 -m pip install -r doc/requirements.txt
3838
python3 -m pip install setuptools
39+
python3 -m pip install pytest
3940
echo PATH=$PATH >> $GITHUB_ENV
4041
4142
- name: Build GDAL
@@ -73,11 +74,19 @@ jobs:
7374
if find . -name '*.rst' | xargs grep "\.\.warning"; then echo 'Wrong annotation. Should be .. warning'; false; fi
7475
if find . -name '*.rst' | xargs grep "\.\.codeblock"; then echo 'Wrong annotation. Should be .. codeblock'; false; fi
7576
working-directory: ./doc
77+
7678
- name: Doxygen
7779
shell: bash -l {0}
7880
run: |
7981
cmake --build . --target doxygen_xml
8082
working-directory: build
83+
84+
- name: Test documentation examples
85+
shell: bash -l {0}
86+
run: |
87+
ctest -V -R doc-examples --output-on-failure
88+
working-directory: build
89+
8190
- name: Spelling
8291
shell: bash -l {0}
8392
run: |

doc/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,13 @@ if (BUILD_DOCS)
204204
-D html_extra_path=extra_path
205205
)
206206

207+
add_test(NAME doc-examples
208+
COMMAND ${CMAKE_COMMAND} -E env ${BUILD_RUN_ENV}
209+
${Python_EXECUTABLE} -m pytest -v --doctest-modules
210+
${CMAKE_BINARY_DIR}/swig/python/osgeo/gdal.py
211+
${CMAKE_BINARY_DIR}/swig/python/osgeo/gdal_array.py
212+
${CMAKE_BINARY_DIR}/swig/python/osgeo/ogr.py
213+
${CMAKE_BINARY_DIR}/swig/python/osgeo/osr.py
214+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
215+
207216
endif ()

0 commit comments

Comments
 (0)