问题标签 [tox]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
213 浏览

python - 环境变量

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

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

我怎么做?

0 投票
1 回答
13409 浏览

python - 如何导入tox中的所有环境变量

我在 setenv 中使用以下从我运行的地方导入环境变量,但是有没有办法导入所有变量,这样我就不需要一个一个地导入。

例如: {env:TEMPEST_CONFIG:} 和 {env:TEMPEST_CONFIG_DIR:} 用于导入这两个变量。

0 投票
1 回答
847 浏览

python - 如何使用 tox 和 py.test 测试 matplotlib 绘图?

如何使用 tox 和 py.test 测试 matplotlib 绘图?

我的文件是:

testtox.py 包含:

毒物.ini:

设置.py:

py.test 可以自己运行:

在这种情况下,绘图窗口会短暂闪烁。

tox 在 DISPLAY 变量上产生错误:

此错误发生在最新版本的 tox (2.1.1) 中。旧版本没有产生错误。

0 投票
1 回答
3691 浏览

python - 属性错误:

我正在为docker-py的模块编写测试,但我似乎无法让测试正常工作。

我正在测试的功能如下所示:

我正在为docker-py的模块编写测试,但我似乎无法让测试正常工作。

我正在测试的功能如下所示:

然后测试看起来像这样:

但是,当我运行测试时,出现以下错误:

这里的任何指示都会有所帮助。


无法在带有块的 UITableViewCell 中设置 UIButton 标题

我有UIButton一个自定义UITableViewCell,当我按下按钮时,它会使用 将数据发布到我的服务器AFNetworking,在成功块中我设置了一个新的按钮标题,但它不起作用。在CutomTableViewCell我使用协议时,我可以响应按钮单击:

然后我实现委托并将数据发布到服务器:

但是,如果我将标题设置为块之外,它会很好地工作:

0 投票
1 回答
1769 浏览

python - Tox virtualenv confusion

Just starting out using tox for testing a library with Python 2.7 and 3.4. After using the following tox.ini file I had two questions:

After running tox I had the following questions:

  1. The project depends on numpy and scipy which are both installed in my global environment, I thought that using sitepackages = True in the tox.ini file would prevent tox from installing these in the virutalenvironment and force it to use those in the global environment but tox installed the latest versions in the .tox/ virtual environments for both 2.7 and 3. Am I misunderstanding the sitepackages directive?
  2. Looking underneath the .tox/ directory at the virtual environment directories I see the following (abbreviated) structure:

.

I assure you that this is not a typo. There are directories named python2.7 under the py3 virtual environment include and lib sub-directories and these are the only sub-directories in include and lib. Everything seems to work but I'm just curious as to why these directories are named this way. Can someone shed some light on this?

Thanks.

0 投票
0 回答
117 浏览

python - 环境变量字符串值在 Windows 上被破坏

我正在尝试在 Windows 上使用 Tox 运行 Python 测试,环境变量如下:

setUp()方法中,我从环境变量中检索值:

这给了我路径错误的错误:

但是,如果我将(完全相同)路径setUp()作为原始字符串文字直接放入方法中,则不会出现错误:

所以我的问题是:为什么环境变量中的值会以某种方式被破坏?我怀疑这是因为"\n"路径中有一个,但我不知道如何正确逃避它。

0 投票
1 回答
804 浏览

python - 结合 tox 为 Travis CI 指定精确的 Python 版本

我有以下 .travis.yml:

和以下tox.ini:

我需要 Python 3.4.3,它在 Travis 不久就可以使用。如何在 .travis.yml 中指定 Python 的确切版本,以便 tox 可以为py34环境使用正确的版本?

0 投票
1 回答
1245 浏览

python - Travis CI 查找和运行测试的 Python 项目结构应该是什么样的?

我目前有一个包含以下.travis.yml文件的项目:

在本地,tox正确执行并运行 35 个测试,但在 Travis CI 上,它运行0 个测试

更多细节:https ://travis-ci.org/neverendingqs/pyiterable/builds/78954867

我还尝试了其他方法,包括:

他们也找不到任何测试

我的项目结构是这样的:

项目/文件夹的结构是否不正确?

0 投票
1 回答
302 浏览

python - 如何在 python 文件更改时重新运行“tox”?

我有一个运行所有测试、pep8 检查和覆盖率检查的毒物配置。每次保存对代码的更改时,我几乎都会手动运行 tox。Tox 通过“nosetests”运行测试和覆盖率报告。

当更改保存到我的 tox.ini 文件下目录结构中的任何位置的 python 文件时,如何使 tox 的重新运行自动发生?

0 投票
4 回答
2902 浏览

python - tox 中的条件命令?(tox、travis-ci 和工作服)

tl;博士:

我正在为我的一个项目设置 CI,托管在 github 上,使用toxtravis-ci. 在构建结束时,我运行converalls将覆盖率报告推送到coveralls.io. 我想让这个命令“有条件”——仅在 travis 上运行测试时执行;不是当它们在我的本地机器上运行时。有没有办法做到这一点?

细节:

我要测试的包是一个 python 包。我正在使用/计划使用以下“基础设施”来设置测试:

  • 测试本身是py.test多种多样的。
  • 可以说,CI 脚本来自tox. 这让我可以在本地运行测试,这对我来说相当重要。我不想每次需要测试运行时都推送到 github。我也在我的包中使用numpymatplotlib,所以运行大量的测试周期对travis-ci我来说似乎过于浪费。因此,放弃tox并简单地.travis.yml单独使用不是一种选择。
  • CI服务器是travis-ci

相关的测试脚本如下所示:

.travis.yml

毒物

这个文件让我在本地运行测试。但是,由于最终coveralls调用,测试原则上失败,其中:

这是预期的错误。该passenv位发送必要的信息,travis以便能够写入coveralls,并且没有 travis 提供此信息,命令应该失败。我也不希望这将结果推送到 coveralls.io。我coveralls只想在测试发生在travis-ci. 有什么方法可以让这个命令有条件地运行,或者设置一个构建配置来达到同样的效果?

我已经尝试将工作服部分移入.travis.yml,但执行时coveralls似乎无法找到.coverage要发送的适当文件。coveralls.io我在这个方向上做了各种尝试,除了上面列出的组合之外,没有一个成功提交。以下是我希望的工作,因为当我在tox本地运行时,我最终会得到一个.coverage我期望的文件 - 在我的源代码树的根文件夹中。

没有提交到coveralls.io