pythonfinder icon indicating copy to clipboard operation
pythonfinder copied to clipboard

Non-deterministic result of pythonfinder

Open jxltom opened this issue 6 years ago • 3 comments

For example, Finder().find_python_version(3, minor=6, patch=6) could return .../.pyenv/versions/3.6.6/bin/python3 or .../.pyenv/versions/3.6.6/bin/python3.6 or.../.pyenv/versions/3.6.6/bin/python3.6m

It looks like the first item which is the path is not sorted in https://github.com/sarugaku/pythonfinder/blob/3126cf2dbb55216402a7f42deffaf8512b03c56d/src/pythonfinder/models/mixins.py#L298. But I don't know why the pytest-xdist still doesn't work even with that fixed by key=operator.itemgetter(1, 0).

jxltom avatar Dec 17 '18 14:12 jxltom

This is only going to be true in a multiprocessing situation isn’t it? Xdist may hit this branch of the code and fork function calls (not sure how it works), but it could be that the sort function only sees partial results sometimes.

It doesn’t actually matter in this particular case but I’m curious if there is a case where it does

techalchemy avatar Dec 17 '18 17:12 techalchemy

Actually I think there are two cases. The first case is that it also affects normal API without multiple process. The above case happens when I called the API normally.

The second case is about xdist, even I fixed the first case, the xdist still doesn't work. Probably there is somewhere else where versions are not sorted correctly.

jxltom avatar Dec 18 '18 01:12 jxltom

Hi. Is this still reproducible in a more recent version of pythonfinder?

brainwane avatar Mar 04 '20 21:03 brainwane

Stale issue

matteius avatar Apr 01 '24 03:04 matteius