How can I configure locale inside the Pants sandbo...
# general
a
How can I configure locale inside the Pants sandbox?
b
Clarification question: how would you hope to be setting it outside of pants? (i.e. if you were doing whatever task directly, without pants?)
LC_ALL=... some-command --args
or similar?
a
I'm doing some hackery trying to run postgres inside the sandbox for tests. Without getting into it too much the db is configured to use en_US.UTF-8, but inside the sandbox locale is unconfigured / C / POSIX
I'm probably lacking knowledge but I'll try to get postgres to run with en_US.UTF-8 by passing it as LC_ALL to the process
b
It looks like you can set env vars for
python_tests
, and even for all tests: https://www.pantsbuild.org/2.21/reference/targets/python_tests#extra_env_vars
Might that help?
a
That's a good suggestion, I already use that for other things. I'll try that, thank you
So I've set the env vars, but Python inside the sandbox is still reporting
(None, None)
for
locale.getlocale()
. Directly on my system it's reporting
('en_US', 'UTF-8')
I'll have to figure out why
b
a
Thanks, I tried running that but the test sandbox itself isn't being preserved. Other sandboxes are though
(I'm doing
--keep-sandboxes=always
)
b
You might need
test --force
to ensure the tests are actually being run, not served from cache
a
Hmm still nothing, now even the other sandboxes are gone
(I'm passing the env vars because they affect test behavior)
b
I suspect the
debug
flag will be getting in the way
Can you try without that one? A process running interactively like that is different to one that runs in the background
a
Ah yes that worked, thanks. I can reproduce the failure with __run.sh