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
Fix wrong version being found #31
Comments
I think if you want to debug this you need to step in with a debugger. I see this: It only finds one PathFinder, which finds one distribution. Could be that for you there’s multiple Also we’d need to know what implementation is used in your case: For me, @staticmethod
def _discover_resolvers():
"""Search the meta_path for resolvers."""
declared = (
getattr(finder, 'find_distributions', None)
for finder in sys.meta_path
)
return filter(None, declared) |
It looks like this was because of some clutter in the virtual environment, maybe from having tested multiple Poetry versions or from some other tool. I'm not exactly sure what happened, but I don't think it's a normal occurrence. I tried modifying the affected test: def test__get_version__from_name() -> None:
import sys
import importlib_metadata as ilm
print("::::: sys.meta_path =", sys.meta_path)
for finder in sys.meta_path:
print(finder)
declared = getattr(finder, "find_distributions", None)
if declared:
try:
results = list(finder.find_distributions(ilm.DistributionFinder.Context(name='dunamai')))
for (i, result) in enumerate(results):
print(f" find_distributions[{i}].version = {result.version}")
print(f" find_distributions[{i}].files = {result.files}")
# print(f" find_distributions[{i}].metadata = {result.metadata}")
except Exception as e:
print(f" error: {e}")
else:
print(" 'find_distributions' not declared")
assert get_version("dunamai") == Version(pkg_resources.get_distribution("dunamai").version) Partial output:
So it was finding multiple versions from these sources:
If I do a fresh clone and
If I update the version in pyproject.toml and run |
@mtkennerly in #29 (comment):
The text was updated successfully, but these errors were encountered: