Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest changes default environment variables when running a file. #12155

Closed
KDot227 opened this issue Mar 24, 2024 · 1 comment
Closed

Pytest changes default environment variables when running a file. #12155

KDot227 opened this issue Mar 24, 2024 · 1 comment

Comments

@KDot227
Copy link

KDot227 commented Mar 24, 2024

For example with the following code

def test_env_vars():
    GOOD_ENV_VARS = {
        "PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC",
        "PUBLIC": r"C:\Users\Public",
        "COMMONPROGRAMFILES(X86)": r"C:\Program Files (x86)\Common Files",
        "PROGRAMFILES": r"C:\Program Files",
        "PROGRAMFILES(X86)": r"C:\Program Files (x86)",
        "DRIVERDATA": r"C:\Windows\System32\Drivers\DriverData",
        "COMMONPROGRAMFILES": r"C:\Program Files\Common Files",
        "COMMONPROGRAMW6432": r"C:\Program Files\Common Files",
        "COMMONPROGRAMFILES(X86)": r"C:\Program Files (x86)\Common Files",
    }
    for env_var, value in GOOD_ENV_VARS.items():
        assert os.environ[env_var] == value, f"{env_var} is not set correctly {os.environ[env_var]}"

On windows 11 on my current machine this will error along with all other latest windows version (I believe). Basically the only issue is that the PATHEXT env variable has .CPL appended to it which it shouldn't be default.

@RonnyPfannschmidt
Copy link
Member

Pytest itself doesn't change environment variables besides the one denoting the current test

@Zac-HD Zac-HD closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants