astropy / sphinx-automodapi

Sphinx extension for generating API documentation
https://sphinx-automodapi.readthedocs.io
BSD 3-Clause "New" or "Revised" License
65 stars 45 forks source link

Fix keyerror on refexplicit and refdoc #100

Closed rocco8773 closed 4 years ago

rocco8773 commented 4 years ago

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 https://github.com/sphinx-doc/sphinx/issues/1572#issuecomment-68590981, 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 commented 4 years ago

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[bot] commented 4 years ago

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%) :arrow_up:

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 commented 4 years ago

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.

virtuald commented 4 years ago

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