Skip to content

Cargo's testsuite can be confused by outside config files #9107

@ehuss

Description

@ehuss

Problem
Adding a .cargo/config file to the root of the cargo source tree with the following contents:

[profile.dev]
debug = 0

will cause the config::profile_env_var_prefix test to fail.

This is because that test is building a Config object directly, instead of spawning a process, and thus the Config object will load all config files found in all parent directories. Normally there is an environment variable to prevent that, but it is not appropriate to set that in the test since it is global.

Possible Solution(s)

Uncertain how to fix this. Perhaps Config could be extended to set how far up the config search will go. Or the test could create a temp directory outside of the user's home directory, and set that as cwd. I think ideally this could be fixed whenever something like #7887 is implemented.

Notes

Latest on master: c3abcfe

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