Author keller00
Recipients keller00, paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware
Date 2020-10-15.05:50:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602741057.44.0.746329954435.issue42041@roundup.psfhosted.org>
In-reply-to
Content
Hey,

Wanted to report this weird behavior I saw recently. Let me first explain how to reproduce and then talk about where I think the issue comes from.

I attached a tar.gz file with 2 Python files in it.

Here's how to reproduce:
0. Make sure that pytest is unavailable in your command line, or please edit to another library that you don't have available from another Python install (make sure to update the import statement in `script1.py`).
1. Untar the 2 scripts into current working directory. Note: I reproduced on a Windows VM (Version 10.0.18363 Build 18363).
2. Make a Python 3.7, or 3.8 environment venv. Note: I used Python 3.8.2.
3. Activate venv and install pytest in it.
4. Run `python run_scripts.py` and observe the error.

Note: The same thing works on Python 3.6 as expected.

My team observed this issue when virtualenv released this Monday. It changed how it works with Windows and Python 3.7+, before it was not using the Windows redirect script generated by venv and just worked like how older versions on Windows do.
But what we are seeing is that if you start a subprocess call to `python` then that gets resolved to the system wide Python binary without the venv site-packages being in PYTHONPATH.
So the subprocess will fail when importing pytest in the subprocess.

If this is not clear please don't hesitate to ask me for clarification, or refer to https://github.com/pypa/virtualenv/issues/1981 for more debugging info.

Another interesting thing that I noticed is that if you make a subprocess call to `pytest` instead then that gets resolved correctly.
History
Date User Action Args
2020-10-15 05:50:57keller00setrecipients: + keller00, paul.moore, vinay.sajip, tim.golden, zach.ware, steve.dower
2020-10-15 05:50:57keller00setmessageid: <1602741057.44.0.746329954435.issue42041@roundup.psfhosted.org>
2020-10-15 05:50:57keller00linkissue42041 messages
2020-10-15 05:50:56keller00create