Skip to content

Added try-catch for autodoc mock-import#89

Draft
RobertoRoos wants to merge 2 commits intomainfrom
bugfix/autodoc-mock-import
Draft

Added try-catch for autodoc mock-import#89
RobertoRoos wants to merge 2 commits intomainfrom
bugfix/autodoc-mock-import

Conversation

@RobertoRoos
Copy link
Copy Markdown
Collaborator

@RobertoRoos RobertoRoos commented Mar 7, 2026

Resolving #82 (again...)

This is the suggestion of @lucc , posted here: #82 (comment)

@RobertoRoos RobertoRoos self-assigned this Mar 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.11%. Comparing base (de7c367) to head (88cd1f0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sphinxarg/ext.py 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
- Coverage   50.15%   50.11%   -0.04%     
==========================================
  Files          18       18              
  Lines        1288     1291       +3     
  Branches      262      263       +1     
==========================================
+ Hits          646      647       +1     
- Misses        598      599       +1     
- Partials       44       45       +1     
Flag Coverage Δ
unittests 49.88% <33.33%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

sphinxarg/ext.py Outdated
Comment on lines +22 to +27
try:
from sphinx.ext.autodoc.mock import mock
except ImportError:
from sphinx.ext.autodoc import mock
# A persistent bug in sphinx / autodoc causes problems during importing (#82)

Copy link
Copy Markdown
Collaborator Author

@RobertoRoos RobertoRoos Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm a little in doubt now. I feel the intended method to import is the short version:

from sphinx.ext.autodoc import mock

So maybe we should prioritize that one. If for no other reason then to prevent us being the cause of an import error for the next package.

EDIT: I changed it but let's see what the bosses say over at sphinx-doc/sphinx#14333

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant