Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix keyerror on refexplicit and refdoc #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 24, 2020

Conversation

rocco8773
Copy link
Contributor

When Spinx updated to v3.0.0, sphinx-automodapi started raising KeyErrors on 'refexplicit' and 'refdoc' in the smart_resolver.missing_reference_handler() function. I could not find the change in Sphinx that caused this, but the update caused the original node to not be populated with these attributes anymore. To resolve this I replaced the key call node['refexplicit'] with a get call node.get('refexplicit'), which applies a default value if the key does not exist.

Based on this very helpful comment sphinx-doc/sphinx#1572 (comment), I added docstrings and comments to better inform what the function does.

Note: I noticed these lines of code were not hit by tests, thus, the tests never failed. I do not know enough about the architecture to write these tests, so I'm open to suggestions.

Closes #99

@bsipocz
Copy link
Member

bsipocz commented Apr 23, 2020

failure is most probably unrelated and I think is present in master, too. I would first try to limit the pytest version to be <5.4 as we had issues with it elsewhere.

@codecov
Copy link

codecov bot commented Apr 23, 2020

Codecov Report

Merging #100 into master will increase coverage by 0.03%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
+ Coverage   87.15%   87.19%   +0.03%     
==========================================
  Files           5        5              
  Lines         693      695       +2     
==========================================
+ Hits          604      606       +2     
  Misses         89       89              
Impacted Files Coverage Δ
sphinx_automodapi/automodapi.py 91.13% <ø> (ø)
sphinx_automodapi/smart_resolver.py 78.78% <75.00%> (+0.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30953a9...01add30. Read the comment docs.

@rocco8773
Copy link
Contributor Author

It looks like the error was with coverage, so I limited that to coverage<5.0.

I also set all the builds to run on the latest versions of macOS, Windows, and Ubuntu. This caused the mac build to actually run. This setup currently works, but I'll leave it up to you to which environments you actually want to test on.

@bsipocz bsipocz requested a review from astrofrog April 23, 2020 03:57
Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the contribution/fix!

@astrofrog astrofrog merged commit 4c8e33c into astropy:master Apr 24, 2020
@virtuald
Copy link

When will a new release be uploaded to pypi with this fix?

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.

builds fail with a KeyError 'refexplicit' when using sphinx 3.0.0
5 participants