Skip to content

Does pants isolate tests from the current user? #12960

Answered by jsirois
wfscheper asked this question in Q&A
Discussion options

You must be logged in to vote

Pants does isolate tests as much as possible from the local environment. By default, this includes not exposing HOME; so an inability to expand ~ seems to make sense. You can selectively expose environment variables to tests: https://www.pantsbuild.org/docs/python-test-goal#setting-environment-variables and you can also expose them more broadly: https://www.pantsbuild.org/docs/reference-subprocess-environment.

I'd suggest trying the following in your pants.toml to start since its the most narrowly scoped leak of hermeticity:

[test]
extra_env_vars = ["HOME"]

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wfscheper
Comment options

@jsirois
Comment options

Answer selected by wfscheper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants