python / importlib_metadata

Library to access metadata for Python packages
https://importlib-metadata.readthedocs.io
Apache License 2.0
127 stars 82 forks source link

Provide `Distribution.origin` reflecting content of direct_url.json. #465

Closed jaraco closed 12 months ago

jaraco commented 1 year ago

Partial implementation of #404.

makslevental commented 1 year ago

Any blockers on this? Would be nice to have.

jaraco commented 12 months ago

diffcov is reporting this failure:

importlib_metadata/__init__.py (71.4%): Missing lines 632,635
jaraco commented 12 months ago

That doesn't even make sense. One of those lines is blank and the other is the beginning of a docstring (executed unconditionally).

https://github.com/python/importlib_metadata/blob/1750cebbe434247fd73c6269ea34b1ebe875c8c1/importlib_metadata/__init__.py#L632-L635

Wait, what? I did just rewrite two commits to remove the unintentionally added other files ("out.txt" and "before.mtree"), but I didn't touch __init__.py, and now the missed expectation is implicating different lines:

importlib_metadata/__init__.py (71.4%): Missing lines 625,628

At least those lines correspond to the lines changed in this diff :).

jaraco commented 12 months ago

I don't understand how the lines aren't covered, given the test specifically exercises the .origin property.

jaraco commented 12 months ago

Oh, maybe the issue is the test isn't derived from unittest.TestCase so isn't discovered.

jaraco commented 12 months ago

Oh, maybe the issue is the test isn't derived from unittest.TestCase so isn't discovered.

Yep. That was it... and demonstrates that the test is not in fact capturing the expectation. Hooray for diffcov for catching an otherwise missed expectation.

makslevental commented 12 months ago

funny i don't remember what i wanted this for but thanks!