mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix a crash in the coverage extension when module contents are not found (#11702)
Signed-off-by: Stephen Finucane <stephen@that.guru> Co-authored-by: Stephen Finucane <stephen@that.guru> Authored-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
parent
fb1e521202
commit
bb74aec2b6
@ -41,6 +41,8 @@ Bugs fixed
|
||||
Patch by Bénédikt Tran.
|
||||
* #11697: HTML Search: add 'noindex' meta robots tag.
|
||||
Patch by James Addison.
|
||||
* #11678: Fix a possible ``ZeroDivisionError`` in ``sphinx.ext.coverage``.
|
||||
Patch by Stephen Finucane.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
@ -290,11 +290,15 @@ class CoverageBuilder(Builder):
|
||||
value = 100.0
|
||||
|
||||
table.append([module, '%.2f%%' % value, '%d' % len(self.py_undocumented[module])])
|
||||
table.append([
|
||||
'TOTAL',
|
||||
f'{100 * len(all_documented_objects) / len(all_objects):.2f}%',
|
||||
f'{len(all_objects) - len(all_documented_objects)}',
|
||||
])
|
||||
|
||||
if all_objects:
|
||||
table.append([
|
||||
'TOTAL',
|
||||
f'{100 * len(all_documented_objects) / len(all_objects):.2f}%',
|
||||
f'{len(all_objects) - len(all_documented_objects)}',
|
||||
])
|
||||
else:
|
||||
table.append(['TOTAL', '100', '0'])
|
||||
|
||||
for line in _write_table(table):
|
||||
op.write(f'{line}\n')
|
||||
|
Loading…
Reference in New Issue
Block a user