gpt4 book ai didi

python - 环境变量

转载 作者:太空宇宙 更新时间:2023-11-03 11:27:40 25 4
gpt4 key购买 nike

我有一个像这样的 tox.ini 文件:

[tox]
envlist =
{py27,py34}

[testenv]
setenv =
PYTHONDONTWRITEBYTECODE=1
deps =
-r{toxinidir}/requirements-test.txt
commands =
nosetests -v --stop --with-coverage --cover-package=project

所以,我需要从我的 SO 向我的 tox env 传递一个环境变量。此变量是私有(private)的,会根据环境而变化。

我该怎么做?

最佳答案

我找到了解决方案! Tox 2.0 有一个名为 passenv 的设置

A list of wildcard environment variable names which shall be copied from the tox invocation environment to the test environment. If a specified environment variable doesn’t exist in the tox invocation environment it is ignored. You can use * and ? to match multiple environment variables with one name. Note that the PATH and PIP_INDEX_URL variables are unconditionally passed down and on Windows SYSTEMROOT, PATHEXT, TEMP and TMP will be passed down as well whereas on unix TMPDIR will be passed down. You can override these variables with the setenv option.

关于python - 环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30836126/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com