Python Pipenv Pipfile脚本中的bash条件

Python Pipenv Pipfile脚本中的bash条件,python,bash,scripting,pipenv,Python,Bash,Scripting,Pipenv,我有一个这样的脚本文件 [script] tests = "pytest --cov-fail-under=40 tests/" 我希望使参数值下的cov失败取决于环境变量。在Pipfile脚本中,以下命令执行此任务: pytest --cov-fail-under=$( case $VARin true ) echo 40 ;; * ) echo 80 ;; esac ) tests/ 但是当使用pipenv运行测试执行时,bash条件显示为一个字符串,产生以下错误:

我有一个这样的脚本文件

[script]
tests = "pytest --cov-fail-under=40 tests/"
我希望使参数值下的cov失败取决于环境变量。在Pipfile脚本中,以下命令执行此任务:

pytest --cov-fail-under=$( case $VARin true ) echo 40 ;; * ) echo 80 ;; esac ) tests/
但是当使用
pipenv运行测试执行时,bash条件显示为一个字符串,产生以下错误:

ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: argument --cov-fail-under: invalid validate_fail_under value: '$('

有什么解决方法吗?

您可以使用
sh-c
生成一个shell:

皮普尔


顺便说一句,建议的方法在pipenv的脚本中不起作用。
ERROR:use:pytest[options][file\u or\u dir][file\u or\u dir][…]pytest:ERROR:argument--cov fail-under:invalid validate\u fail\u under-value:'${MIN\u COVERAGE:-40}'
是否使用了单引号?还是仅仅是错误信息?如果是这样,你能试试双引号吗?我必须安装pipenv来测试它,可以吗。
[scripts]
tests = "sh -c '[ \"${VAR}\" = \"true\" ] && mincov=40 ; pytest --cov-fail-under=\"${mincov:-80}\" tests'"