You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works as expected, when everything is installed into virtualenv - if both pytest and the py library are installed, the package is preferred over the module, and import py loads the full library.
However, things go wrong when py is installed in system site-packages, and pytest is installed in a virtualenv. In this case, py module, not the package is loaded for import py, and plugins that depend on the full py library are breaking (pytest-dev/pytest#10451)
I started working on a solution: pytest-dev/pytest#10616 and found that it's quite similar to _distutils_hack here - except in pytest the finder needs to be added to the other end of meta_path.
I also see the "Please do not replicate this behavior." comment in setup.py. So I wonder: why? What are known downsides? Or is there maybe a better solution for my case?
Mentioning @jaraco@pganssle because of _distutils_hack git history.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Recently, pytest started shipping a minimized version of
py
library as a module: https://github.com/pytest-dev/pytest/blob/main/src/py.pyThe real, full
py
library is a package: https://github.com/pytest-dev/pyIt works as expected, when everything is installed into virtualenv - if both pytest and the
py
library are installed, the package is preferred over the module, andimport py
loads the full library.However, things go wrong when
py
is installed in system site-packages, and pytest is installed in a virtualenv. In this case,py
module, not the package is loaded forimport py
, and plugins that depend on the fullpy
library are breaking (pytest-dev/pytest#10451)I started working on a solution: pytest-dev/pytest#10616 and found that it's quite similar to
_distutils_hack
here - except in pytest the finder needs to be added to the other end ofmeta_path
.I also see the "Please do not replicate this behavior." comment in
setup.py
. So I wonder: why? What are known downsides? Or is there maybe a better solution for my case?Mentioning @jaraco @pganssle because of
_distutils_hack
git history.Beta Was this translation helpful? Give feedback.
All reactions