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
I'm trying to use pytest-xdist together with tox to test a python extension written with cython.
When I run tox, it creates a new virtualenv, compiles my project and installs it to ./.tox/.../site-packages/modulename so that there is a directory with source code (./project/modulename) and a directory with compiled python extensions (./project/.tox/.../site-packages/modulename):
When running normally, there is ./project/.tox/python/.../site-packages in PYTHONPATH and there is no ./project in it so modulename from site-packages imported when testing.
However, xdist adds ./project to PYTHONPATH (before .tox/.../site-packages) which causes modulename from project root being imported instead of modulename from site-packages. And everything fails with ImportError because there are no .so files in that modulename from project root.
As I understand, the code that adds cwd to pythonpath is here and it seems like there is no way to control this.
I propose adding a setting (a cli parameter) to disable this behavior.
The text was updated successfully, but these errors were encountered:
I've realized that the problem is a bit deeper that I thought. Py.test runs tests against the current development version of program, therefore it should ignore any package with the same name installed globally. On the other hand, you may have a special develop install (as in my case) and you want to run tests against that install. So maybe this should be solved by adding an option to py.test to remove cwd from pythonpath.
Hello!
I'm trying to use pytest-xdist together with tox to test a python extension written with cython.
When I run tox, it creates a new virtualenv, compiles my project and installs it to
./.tox/.../site-packages/modulename
so that there is a directory with source code (./project/modulename
) and a directory with compiled python extensions (./project/.tox/.../site-packages/modulename
):When running normally, there is
./project/.tox/python/.../site-packages
in PYTHONPATH and there is no./project
in it somodulename
fromsite-packages
imported when testing.However, xdist adds
./project
to PYTHONPATH (before.tox/.../site-packages
) which causesmodulename
from project root being imported instead ofmodulename
fromsite-packages
. And everything fails withImportError
because there are no.so
files in thatmodulename
from project root.As I understand, the code that adds cwd to pythonpath is here and it seems like there is no way to control this.
I propose adding a setting (a cli parameter) to disable this behavior.
The text was updated successfully, but these errors were encountered: