Description
My setup is a bit elaborate since I am using pyinstaller
and running pytest
from the bundled executable. Anyway, I can tell from the header that pytest
is using C:\
as a rootdir and generates C:\.pytest_cache
, which I would like to avoid.
By debugging determine_setup
pytest/src/_pytest/config/findpaths.py
Lines 175 to 218 in bc4e70e
I have found that it is being called with the following parameters:
inifile = None
args = ['C:\\Users\\bers\\AppData\\Local\\Temp\\_MEI138802\\project']
rootdir_cmd_arg = None
rootdir = None
config = <_pytest.config.Config object at 0x0000021A33D60490>
I have no relevant config in the app bundle, so the function passes via
pytest/src/_pytest/config/findpaths.py
Lines 205 to 208 in bc4e70e
with
cwd = WindowsPath('C:/Code/project')
ancestor = WindowsPath('C:/Users/bers/AppData/Local/Temp/_MEI138802/project')
rootdir = get_common_ancestor([cwd, ancestor])
returns WindowsPath('C:/')
, but the following check returns false
as os.path.splitdrive(str(rootdir))[1]
is "\\"
, not "/"
. As a consequence, rootdir
is not set to ancestor
, but remains at WindowsPath('C:/')
, which I believe is not intended.
TLDR: In
pytest/src/_pytest/config/findpaths.py
Line 206 in bc4e70e
"/"
to os.sep
.