【发布时间】:2021-02-17 15:01:35
【问题描述】:
我有一个带有此类脚本的 Pipfile
[script]
tests = "pytest --cov-fail-under=40 tests/"
我想让 cov-fail-under 参数值依赖于环境变量。在 Pipfile 脚本之外,以下命令完成了这项工作:
pytest --cov-fail-under=$( case $VARin true ) echo 40 ;; * ) echo 80 ;; esac ) tests/
但是当使用pipenv run tests 执行时,bash 条件显示为一个字符串,产生以下错误:
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: argument --cov-fail-under: invalid validate_fail_under value: '$('
有什么办法可以解决这个问题吗?
【问题讨论】:
标签: python bash scripting pipenv