Skip to content

Include windir by default in pass_env #3302

@kurtmckee

Description

@kurtmckee

What's the problem this feature will solve?

When running tools in a tox environment, some applications require that the WINDIR environment variable exists. The existence of that environment variables is guaranteed since Windows 95, and no application ever documents this requirement.

I've learned this through years of past experience, but bumped into this again today with this minimal reproducer tox.ini on Windows (assuming a proper project exists):

[testenv:build]
deps = poetry
commands = poetry build

Running this shows the following output (note the "system cannot find the path specified" messages):

build: commands[0]> poetry build
Building sqliteimport (0.2.0)
  - Building sdist
The system cannot find the path specified.
  - Built sqliteimport-0.2.0.tar.gz
  - Building wheel
The system cannot find the path specified.
  - Built sqliteimport-0.2.0-py3-none-any.whl

This is ultimately happening because Poetry assumes that it can call %WINDIR%\System32\where.exe to find the git executable:

if WINDOWS:
    # Finding git via where.exe
    where = "%WINDIR%\\System32\\where.exe"

While I can hunt this down in an open source Python project, this type of failure is very difficult to identify in compiled executables.

Describe the solution you'd like

I want to add the windir environment variable to the list of default environment variables included in pass_env, because it is just as critical as TMP and USERPROFILE.

Alternative Solutions

There's no alternative solution. Tox can add windir to the default list of pass_env, or developers will individually have to figure out for themselves how to resolve failures with some Windows applications run by tox.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions