-
Hey all, I'm running into a strange problem with adopting pants for an existing set of python projects. One of my core libraries imports gitpython, and I just started getting an import error in my test suite when that package is loaded:
If I run I stepped through the import with pdb, and eventually gitpython is simply running git in a subprocess. This makes me wonder if pants is doing something so that For anyone coming to this later, a temporary workaround is to comment out the line including pants is version 2.6.0 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Pants does isolate tests as much as possible from the local environment. By default, this includes not exposing I'd suggest trying the following in your [test]
extra_env_vars = ["HOME"] |
Beta Was this translation helpful? Give feedback.
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: