tox
tox copied to clipboard
posargs break when run on a subst'd drive
Issue
Resolution of the absolute paths for posargs arguments fails when the tox root directory is located on a drive mapped with subst.
This happens, when e.g. a pytest test file is specified on the command line.
In my case, the sources are mapped to a Windows "drive" from inside a WSL distro (using subst W: \\wsl$\distro\path), but it also can be reproduced in Windows only.
The error is a combination of different aspects:
- pathlib's resolve() is called for the root path in all cases, even when it is already absolute (config/main.py:101,
make()). - resolve() does also resolve the subst drive letter to the original path, changing the drive and path prefix
- not all paths are resolve()d during the processing of posargs
- os.path.relpath() gets called to strip the prefix from posargs up to the tox root, but fails due to different drive letters and prefixes
Environment
- OS: Windows 10
- Python 3.11.4 64bit
- tox 4.7.0
Output of pip list of the host Python, where tox is installed
Package Version
------------------------- -----------
annotated-types 0.5.0
attrs 23.1.0
black 23.7.0
build 0.10.0
CacheControl 0.12.14
cachetools 5.3.1
certifi 2023.7.22
chardet 5.2.0
charset-normalizer 3.2.0
cleo 2.0.1
click 8.1.5
colorama 0.4.6
crashtest 0.4.1
distlib 0.3.7
dulwich 0.21.5
filelock 3.12.2
flake8 6.0.0
html5lib 1.1
idna 3.4
importlib-metadata 6.8.0
installer 0.7.0
jaraco.classes 3.3.0
jsonschema 4.19.0
jsonschema-specifications 2023.7.1
keyring 23.13.1
lockfile 0.12.2
mccabe 0.7.0
more-itertools 10.1.0
msgpack 1.0.5
mypy 1.4.1
mypy-extensions 1.0.0
packaging 23.1
pathspec 0.11.1
pexpect 4.8.0
pip 23.2.1
pkginfo 1.9.6
platformdirs 3.10.0
pluggy 1.2.0
poetry 1.5.1
poetry-core 1.6.1
poetry-plugin-export 1.4.0
ptyprocess 0.7.0
pycodestyle 2.10.0
pydantic 2.0.3
pydantic_core 2.3.0
pyflakes 3.0.1
pyproject-api 1.5.3
pyproject_hooks 1.0.0
pywin32-ctypes 0.2.2
rapidfuzz 2.15.1
referencing 0.30.2
requests 2.31.0
requests-toolbelt 1.0.0
rpds-py 0.9.2
setuptools 65.5.0
shellingham 1.5.0.post1
six 1.16.0
tomlkit 0.12.1
tox 4.7.0
trove-classifiers 2023.7.6
typing_extensions 4.7.1
urllib3 1.26.16
virtualenv 20.24.2
webencodings 0.5.1
zipp 3.16.2
Output of running tox
Output of tox -rvv -- test.py on the subst drive
O:\tox_resolve_test\> tox -rvv -- test.py
py: 345 W remove tox env folder C:\_work\py\tox_resolve_test\.tox\py [tox\tox_env\api.py:322]
py: 601 I find interpreter for spec PythonSpec(path=C:\Toolchain\Python\Python311\python.exe) [virtualenv\discovery\builtin.py:58]
py: 601 I proposed PythonInfo(spec=CPython3.11.4.final.0-64, exe=C:\Toolchain\Python\Python311\python.exe, platform=win32, version='3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-utf-8) [virtualenv\discovery\builtin.py:65]
py: 601 D accepted PythonInfo(spec=CPython3.11.4.final.0-64, exe=C:\Toolchain\Python\Python311\python.exe, platform=win32, version='3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-utf-8) [virtualenv\discovery\builtin.py:67]
py: 601 D symlink on filesystem does not work [virtualenv\info.py:45]
py: 601 D filesystem is not case-sensitive [virtualenv\info.py:26]
py: 665 I create virtual environment via CPython3Windows(dest=C:\_work\py\tox_resolve_test\.tox\py, clear=False, no_vcs_ignore=False, global=False) [virtualenv\run\session.py:50]
py: 665 D create folder C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages [virtualenv\util\path\_sync.py:12]
py: 665 D create folder C:\_work\py\tox_resolve_test\.tox\py\Scripts [virtualenv\util\path\_sync.py:12]
py: 665 D write C:\_work\py\tox_resolve_test\.tox\py\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
py: 665 D home = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 665 D implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
py: 665 D version_info = 3.11.4.final.0 [virtualenv\create\pyenv_cfg.py:36]
py: 665 D virtualenv = 20.24.2 [virtualenv\create\pyenv_cfg.py:36]
py: 665 D include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
py: 665 D base-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 665 D base-exec-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 665 D base-executable = C:\Toolchain\Python\Python311\python.exe [virtualenv\create\pyenv_cfg.py:36]
py: 665 D copy C:\Toolchain\Python\Python311\Lib\venv\scripts\nt\python.exe to C:\_work\py\tox_resolve_test\.tox\py\Scripts\python.exe [virtualenv\util\path\_sync.py:40]
py: 665 D copy C:\Toolchain\Python\Python311\Lib\venv\scripts\nt\pythonw.exe to C:\_work\py\tox_resolve_test\.tox\py\Scripts\pythonw.exe [virtualenv\util\path\_sync.py:40]
py: 665 D create virtualenv import hook file C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\_virtualenv.pth [virtualenv\create\via_global_ref\api.py:91]
py: 665 D create C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\_virtualenv.py [virtualenv\create\via_global_ref\api.py:94]
py: 665 D ============================== target debug ============================== [virtualenv\run\session.py:52]
py: 665 D debug via 'C:\_work\py\tox_resolve_test\.tox\py\Scripts\python.exe' 'C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\create\debug.py' [virtualenv\create\creator.py:200]
py: 665 D {
"sys": {
"executable": "C:\\_work\\py\\tox_resolve_test\\.tox\\py\\Scripts\\python.exe",
"_base_executable": "C:\\Toolchain\\Python\\Python311\\python.exe",
"prefix": "C:\\_work\\py\\tox_resolve_test\\.tox\\py",
"base_prefix": "C:\\Toolchain\\Python\\Python311",
"real_prefix": null,
"exec_prefix": "C:\\_work\\py\\tox_resolve_test\\.tox\\py",
"base_exec_prefix": "C:\\Toolchain\\Python\\Python311",
"path": [
"C:\\Toolchain\\Python\\Python311\\python311.zip",
"C:\\Toolchain\\Python\\Python311\\DLLs",
"C:\\Toolchain\\Python\\Python311\\Lib",
"C:\\Toolchain\\Python\\Python311",
"C:\\_work\\py\\tox_resolve_test\\.tox\\py",
"C:\\_work\\py\\tox_resolve_test\\.tox\\py\\Lib\\site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "cp1252"
},
"version": "3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]",
"makefile_filename": "C:\\Toolchain\\Python\\Python311\\Lib\\config\\Makefile",
"os": "<module 'os' (frozen)>",
"site": "<module 'site' (frozen)>",
"datetime": "<module 'datetime' from 'C:\\\\Toolchain\\\\Python\\\\Python311\\\\Lib\\\\datetime.py'>",
"math": "<module 'math' (built-in)>",
"json": "<module 'json' from 'C:\\\\Toolchain\\\\Python\\\\Python311\\\\Lib\\\\json\\\\__init__.py'>"
} [virtualenv\run\session.py:53]
py: 816 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\MYUSER\AppData\Local\pypa\virtualenv) [virtualenv\run\session.py:57]
py: 816 D install pip from wheel C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.2.1-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 816 D install setuptools from wheel C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\seed\wheels\embed\setuptools-68.0.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 816 D install wheel from wheel C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\seed\wheels\embed\wheel-0.41.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 816 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pip [virtualenv\util\path\_sync.py:40]
py: 816 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\distutils-precedence.pth to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\distutils-precedence.pth [virtualenv\util\path\_sync.py:40]
py: 816 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\wheel [virtualenv\util\path\_sync.py:40]
py: 816 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\pkg_resources to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pkg_resources [virtualenv\util\path\_sync.py:40]
py: 854 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel-0.41.0.dist-info to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\wheel-0.41.0.dist-info [virtualenv\util\path\_sync.py:40]
py: 871 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel-0.41.0.virtualenv to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\wheel-0.41.0.virtualenv [virtualenv\util\path\_sync.py:40]
py: 878 D generated console scripts wheel3.11.exe wheel.exe wheel-3.11.exe wheel3.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 887 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\setuptools [virtualenv\util\path\_sync.py:40]
py: 1124 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools-68.0.0.dist-info to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\setuptools-68.0.0.dist-info [virtualenv\util\path\_sync.py:40]
py: 1124 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools-68.0.0.virtualenv to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\setuptools-68.0.0.virtualenv [virtualenv\util\path\_sync.py:40]
py: 1124 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\_distutils_hack to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\_distutils_hack [virtualenv\util\path\_sync.py:40]
py: 1140 D generated console scripts [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 1399 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip-23.2.1.dist-info to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pip-23.2.1.dist-info [virtualenv\util\path\_sync.py:40]
py: 1399 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip-23.2.1.virtualenv to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pip-23.2.1.virtualenv [virtualenv\util\path\_sync.py:40]
py: 1415 D generated console scripts pip.exe pip3.11.exe pip-3.11.exe pip3.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 1415 I add activators for Bash, Batch, Fish, Nushell, PowerShell, Python [virtualenv\run\session.py:63]
py: 1417 D write C:\_work\py\tox_resolve_test\.tox\py\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
py: 1417 D home = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 1417 D implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
py: 1417 D version_info = 3.11.4.final.0 [virtualenv\create\pyenv_cfg.py:36]
py: 1417 D virtualenv = 20.24.2 [virtualenv\create\pyenv_cfg.py:36]
py: 1417 D include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
py: 1417 D base-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 1417 D base-exec-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 1417 D base-executable = C:\Toolchain\Python\Python311\python.exe [virtualenv\create\pyenv_cfg.py:36]
py: 1417 E internal error [tox\session\cmd\run\single.py:59]
Traceback (most recent call last):
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\__init__.py", line 75, in replacer
replaced = replace(conf, self, raw_, args_) # do replacements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\replace.py", line 57, in replace
return Replacer(conf, loader, conf_args=args, depth=depth).join(find_replace_expr(value))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\replace.py", line 186, in join
return "".join(self(value))
^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\replace.py", line 183, in __call__
return [self._replace_match(me) if isinstance(me, MatchExpression) else str(me) for me in value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\replace.py", line 183, in <listcomp>
return [self._replace_match(me) if isinstance(me, MatchExpression) else str(me) for me in value]
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\replace.py", line 202, in _replace_match
replace_value = replace_pos_args(self.conf, args, conf_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\replace.py", line 313, in replace_pos_args
pos_args = conf.pos_args(to_path)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\main.py", line 62, in pos_args
relative = os.path.relpath(path_arg_str, to_path_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen ntpath>", line 754, in relpath
ValueError: path is on mount 'O:', start on mount 'C:'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\session\cmd\run\single.py", line 47, in _evaluate
code, outcomes = run_commands(tox_env, no_test)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\session\cmd\run\single.py", line 84, in run_commands
status_main = run_command_set(tox_env, "commands", chdir, ignore_errors, outcomes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\session\cmd\run\single.py", line 103, in run_command_set
command_set: list[Command] = tox_env.conf[key]
~~~~~~~~~~~~^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\sets.py", line 118, in __getitem__
return self.load(item)
^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\sets.py", line 129, in load
return config_definition.__call__(self._conf, self.loaders, ConfigLoadArgs(chain, self.name, self.env_name))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\of_type.py", line 97, in __call__
value = loader.load(key, self.of_type, self.factory, conf, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\api.py", line 123, in load
return self.build(key, of_type, factory, conf, raw, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\__init__.py", line 84, in build
prepared = replacer(raw, args) if not delay_replace else raw
^^^^^^^^^^^^^^^^^^^
File "C:\Toolchain\Python\Python311\Lib\site-packages\tox\config\loader\ini\__init__.py", line 81, in replacer
raise HandledError(msg) from exception
tox.report.HandledError: replace failed in py.commands with ValueError("path is on mount 'O:', start on mount 'C:'")
py: FAIL code 2 (1.12 seconds)
evaluation failed :( (1.27 seconds)
Output of tox -rvv -- test.py on the real path
C:\_work\py\tox_resolve_test\>tox -rvv -- test.py
py: 347 W remove tox env folder C:\_work\py\tox_resolve_test\.tox\py [tox\tox_env\api.py:322]
py: 601 I find interpreter for spec PythonSpec(path=C:\Toolchain\Python\Python311\python.exe) [virtualenv\discovery\builtin.py:58]
py: 601 I proposed PythonInfo(spec=CPython3.11.4.final.0-64, exe=C:\Toolchain\Python\Python311\python.exe, platform=win32, version='3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-utf-8) [virtualenv\discovery\builtin.py:65]
py: 601 D accepted PythonInfo(spec=CPython3.11.4.final.0-64, exe=C:\Toolchain\Python\Python311\python.exe, platform=win32, version='3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-utf-8) [virtualenv\discovery\builtin.py:67]
py: 601 D symlink on filesystem does not work [virtualenv\info.py:45]
py: 616 D filesystem is not case-sensitive [virtualenv\info.py:26]
py: 663 I create virtual environment via CPython3Windows(dest=C:\_work\py\tox_resolve_test\.tox\py, clear=False, no_vcs_ignore=False, global=False) [virtualenv\run\session.py:50]
py: 663 D create folder C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages [virtualenv\util\path\_sync.py:12]
py: 663 D create folder C:\_work\py\tox_resolve_test\.tox\py\Scripts [virtualenv\util\path\_sync.py:12]
py: 663 D write C:\_work\py\tox_resolve_test\.tox\py\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
py: 663 D home = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 663 D implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
py: 663 D version_info = 3.11.4.final.0 [virtualenv\create\pyenv_cfg.py:36]
py: 663 D virtualenv = 20.24.2 [virtualenv\create\pyenv_cfg.py:36]
py: 663 D include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
py: 663 D base-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 663 D base-exec-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 663 D base-executable = C:\Toolchain\Python\Python311\python.exe [virtualenv\create\pyenv_cfg.py:36]
py: 663 D copy C:\Toolchain\Python\Python311\Lib\venv\scripts\nt\python.exe to C:\_work\py\tox_resolve_test\.tox\py\Scripts\python.exe [virtualenv\util\path\_sync.py:40]
py: 663 D copy C:\Toolchain\Python\Python311\Lib\venv\scripts\nt\pythonw.exe to C:\_work\py\tox_resolve_test\.tox\py\Scripts\pythonw.exe [virtualenv\util\path\_sync.py:40]
py: 679 D create virtualenv import hook file C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\_virtualenv.pth [virtualenv\create\via_global_ref\api.py:91]
py: 679 D create C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\_virtualenv.py [virtualenv\create\via_global_ref\api.py:94]
py: 679 D ============================== target debug ============================== [virtualenv\run\session.py:52]
py: 679 D debug via 'C:\_work\py\tox_resolve_test\.tox\py\Scripts\python.exe' 'C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\create\debug.py' [virtualenv\create\creator.py:200]
py: 679 D {
"sys": {
"executable": "C:\\_work\\py\\tox_resolve_test\\.tox\\py\\Scripts\\python.exe",
"_base_executable": "C:\\Toolchain\\Python\\Python311\\python.exe",
"prefix": "C:\\_work\\py\\tox_resolve_test\\.tox\\py",
"base_prefix": "C:\\Toolchain\\Python\\Python311",
"real_prefix": null,
"exec_prefix": "C:\\_work\\py\\tox_resolve_test\\.tox\\py",
"base_exec_prefix": "C:\\Toolchain\\Python\\Python311",
"path": [
"C:\\Toolchain\\Python\\Python311\\python311.zip",
"C:\\Toolchain\\Python\\Python311\\DLLs",
"C:\\Toolchain\\Python\\Python311\\Lib",
"C:\\Toolchain\\Python\\Python311",
"C:\\_work\\py\\tox_resolve_test\\.tox\\py",
"C:\\_work\\py\\tox_resolve_test\\.tox\\py\\Lib\\site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "cp1252"
},
"version": "3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]",
"makefile_filename": "C:\\Toolchain\\Python\\Python311\\Lib\\config\\Makefile",
"os": "<module 'os' (frozen)>",
"site": "<module 'site' (frozen)>",
"datetime": "<module 'datetime' from 'C:\\\\Toolchain\\\\Python\\\\Python311\\\\Lib\\\\datetime.py'>",
"math": "<module 'math' (built-in)>",
"json": "<module 'json' from 'C:\\\\Toolchain\\\\Python\\\\Python311\\\\Lib\\\\json\\\\__init__.py'>"
} [virtualenv\run\session.py:53]
py: 801 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\MYUSER\AppData\Local\pypa\virtualenv) [virtualenv\run\session.py:57]
py: 801 D install pip from wheel C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.2.1-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 801 D install setuptools from wheel C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\seed\wheels\embed\setuptools-68.0.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 801 D install wheel from wheel C:\Toolchain\Python\Python311\Lib\site-packages\virtualenv\seed\wheels\embed\wheel-0.41.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
py: 801 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pip [virtualenv\util\path\_sync.py:40]
py: 801 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\distutils-precedence.pth to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\distutils-precedence.pth [virtualenv\util\path\_sync.py:40]
py: 801 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\wheel [virtualenv\util\path\_sync.py:40]
py: 801 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\pkg_resources to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pkg_resources [virtualenv\util\path\_sync.py:40]
py: 848 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel-0.41.0.dist-info to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\wheel-0.41.0.dist-info [virtualenv\util\path\_sync.py:40]
py: 848 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.41.0-py3-none-any\wheel-0.41.0.virtualenv to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\wheel-0.41.0.virtualenv [virtualenv\util\path\_sync.py:40]
py: 864 D generated console scripts wheel-3.11.exe wheel.exe wheel3.11.exe wheel3.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 864 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\setuptools [virtualenv\util\path\_sync.py:40]
py: 1080 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools-68.0.0.dist-info to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\setuptools-68.0.0.dist-info [virtualenv\util\path\_sync.py:40]
py: 1086 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\setuptools-68.0.0.virtualenv to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\setuptools-68.0.0.virtualenv [virtualenv\util\path\_sync.py:40]
py: 1086 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-68.0.0-py3-none-any\_distutils_hack to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\_distutils_hack [virtualenv\util\path\_sync.py:40]
py: 1086 D generated console scripts [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 1350 D copy directory C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip-23.2.1.dist-info to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pip-23.2.1.dist-info [virtualenv\util\path\_sync.py:40]
py: 1365 D copy C:\Users\MYUSER\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.2.1-py3-none-any\pip-23.2.1.virtualenv to C:\_work\py\tox_resolve_test\.tox\py\Lib\site-packages\pip-23.2.1.virtualenv [virtualenv\util\path\_sync.py:40]
py: 1365 D generated console scripts pip.exe pip3.exe pip-3.11.exe pip3.11.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
py: 1365 I add activators for Bash, Batch, Fish, Nushell, PowerShell, Python [virtualenv\run\session.py:63]
py: 1380 D write C:\_work\py\tox_resolve_test\.tox\py\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
py: 1380 D home = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 1380 D implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
py: 1380 D version_info = 3.11.4.final.0 [virtualenv\create\pyenv_cfg.py:36]
py: 1380 D virtualenv = 20.24.2 [virtualenv\create\pyenv_cfg.py:36]
py: 1380 D include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
py: 1380 D base-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 1380 D base-exec-prefix = C:\Toolchain\Python\Python311 [virtualenv\create\pyenv_cfg.py:36]
py: 1380 D base-executable = C:\Toolchain\Python\Python311\python.exe [virtualenv\create\pyenv_cfg.py:36]
py: 1380 W commands[0]> python test.py [tox\tox_env\api.py:427]
test.py executed
py: 1466 I exit 0 (0.09 seconds) C:\_work\py\tox_resolve_test> python test.py pid=2096 [tox\execute\api.py:279]
py: OK (1.12=setup[1.03]+cmd[0.09] seconds)
congratulations :) (1.25 seconds)
Minimal example
tox.ini:
[testenv]
commands =
python {posargs}
test.py:
print("test.py executed")
subst mount:
subst O: C:\_work\py\
Some ideas on the topic:
- Not resolving root when it already
root.is_absolute()would work for my specific usecase, but could break if the root is mapped and relative - Resolving all paths for root and posargs could work, but:
- Resolving the path at all may lead to other issues, if the real path is a UNC path, which was specifically mapped to a drive to avoid some issue with tools that don't handle UNC. There is a discussion about that at https://discuss.python.org/t/pathlib-absolute-vs-resolve/2573
- Using mapped network drives (SMB share) doesn't have the same issue, it seems.
resolve()does not expose the mapped location for that.