Skip to content

Commit

Permalink
Fail on blanks in passed env vars
Browse files Browse the repository at this point in the history
Avoids to oversee pass_env/passenv going from blank to comma separated list
Resolves #2658
  • Loading branch information
ericzolf committed Dec 10, 2022
1 parent 5192d3d commit a0ce86c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -3,7 +3,7 @@
Please, make sure you address all the checklists (for details on how see
[development documentation](http://tox.readthedocs.org/en/latest/development.html#development))!

- [ ] ran the linter to address style issues (`tox -e fix_lint`)
- [ ] ran the linter to address style issues (`tox -e fix`)
- [ ] wrote descriptive pull request text
- [ ] ensured there are test(s) validating the fix
- [ ] added news fragment in `docs/changelog` folder
Expand Down
8 changes: 7 additions & 1 deletion src/tox/tox_env/api.py
Expand Up @@ -21,7 +21,7 @@
from tox.execute.request import ExecuteRequest
from tox.journal import EnvJournal
from tox.report import OutErr, ToxHandler
from tox.tox_env.errors import Recreate, Skip
from tox.tox_env.errors import Fail, Recreate, Skip
from tox.tox_env.info import Info
from tox.tox_env.installer import Installer
from tox.util.path import ensure_empty_dir
Expand Down Expand Up @@ -131,6 +131,12 @@ def register_config(self) -> None:
)

def pass_env_post_process(values: list[str]) -> list[str]:
blank_values = [v for v in values if " " in v or "\t" in v]
if blank_values:
raise Fail(
f"pass_env/passenv variable can't have values containing "
f"blanks like {blank_values}; a comma is possibly missing",
)
values.extend(self._default_pass_env())
return sorted({k: None for k in values}.keys())

Expand Down

0 comments on commit a0ce86c

Please sign in to comment.