mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix some older tools (not using `profile` or `stdio`) failing because
of the following warning printed on stderr when run locally on macOS:
```
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LC_CTYPE = "C.UTF-8",
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
```
21 lines
553 B
Python
21 lines
553 B
Python
import os
|
|
|
|
from galaxy.util.commands import new_clean_env
|
|
|
|
|
|
def test_new_clean_env() -> None:
|
|
saved_environ = os.environ.copy()
|
|
os.environ["FOO"] = "foo"
|
|
os.environ.pop("TMPDIR", None)
|
|
try:
|
|
clean_env = new_clean_env()
|
|
finally:
|
|
os.environ.clear()
|
|
os.environ.update(saved_environ)
|
|
assert "FOO" not in clean_env
|
|
for k in ("HOME", "PATH"):
|
|
if k in saved_environ:
|
|
assert clean_env[k] == saved_environ[k]
|
|
assert clean_env["LC_CTYPE"].endswith("UTF-8")
|
|
assert clean_env["TMPDIR"]
|