我有一个带有这样的脚本的Pipfile
[script]
tests = "pytest --cov-fail-under=40 tests/"我想让cov-fail-under参数值依赖于env。在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: '$('有什么办法解决这个问题吗?
发布于 2020-11-04 22:08:32
您可以使用sh -c生成一个shell
Pipfile
[scripts]
tests = "sh -c '[ \"${VAR}\" = \"true\" ] && mincov=40 ; pytest --cov-fail-under=\"${mincov:-80}\" tests'"https://stackoverflow.com/questions/64688174
复制相似问题