@@ -192,9 +192,25 @@ def doc(session):
192
192
193
193
if not session .interactive :
194
194
session .run ('sphinx-build' , * sphinx_args )
195
- # TODO: implement doc_cover that works with sphinx-argparse
195
+ session . notify ( ' doc_cover' )
196
196
else :
197
197
sphinx_args [- 2 :- 2 ] = [
198
- '--open-browser' , '--watch' , '../b2' , '--ignore' , '*.pyc' , '--ignore' , '*~'
198
+ '-E' , '- -open-browser' , '--watch' , '../b2' , '--ignore' , '*.pyc' , '--ignore' , '*~'
199
199
]
200
200
session .run ('sphinx-autobuild' , * sphinx_args )
201
+
202
+
203
+ @nox .session
204
+ def doc_cover (session ):
205
+ """Perform coverage analysis for the documentation."""
206
+ install_myself (session , extras = ['doc' ])
207
+ session .cd ('doc' )
208
+ sphinx_args = ['-b' , 'coverage' , '-T' , '-W' , 'source' , 'build/coverage' ]
209
+ report_file = 'build/coverage/python.txt'
210
+ session .run ('sphinx-build' , * sphinx_args )
211
+ session .run ('cat' , report_file , external = True )
212
+
213
+ with open ('build/coverage/python.txt' ) as fd :
214
+ # If there is no undocumented files, the report should have only 2 lines (header)
215
+ if sum (1 for _ in fd ) != 2 :
216
+ session .error ('sphinx coverage has failed' )
0 commit comments