python - 是否可以在 tox 中运行广度优先而不是深度优先?
问题描述
我有一套小型测试总共需要大约 40 秒才能运行,我有一套中等测试总共需要大约 40 分钟才能运行。
我希望订单像这样运行:
- py27小测试
- py37小测试
- py27 中等测试
- py37 中等测试
相反, tox 运行它就像
- py27小测试
- py27 中等测试
- py37小测试
- py37 中等测试
这样做的问题是,如果一些简单的事情破坏了一个小测试,我想立即知道它。中等测试(如集成测试)是额外的安全层,可以排除更多问题,但需要更长的时间才能完成。
[tox]
envlist = py27,py37
[testenv:py27]
deps =
pytest
pytest-cov
pytest-mock
pylint
; packages specified by the setup.py cover the other dependencies for py2.7
commands =
pytest -v --ignore-glob="*medium*" --doctest-modules
pytest -v tests/medium_tests
解决方案
我不是毒物专家,但这样的事情可能会有所帮助:
[tox]
envlist = {s,m}-{py27,py37}
[testenv]
deps =
pytest
commands =
s: pytest -v -k 'not medium'
m: pytest -v -k 'medium'
你所有的短测试命令都应该有前缀s:
,所有中等测试命令都应该有前缀m:
。重要的是 env 列表{s,m}-{py27,py37}
将按顺序通过s-py27
, s-py37
, m-py27
,运行m-py37
。
推荐阅读
- android - 使用 gnirehtet 从 Android 设备获取 PC IP 地址
- ios - 字符串格式,如循环 swift4 中的表格
- batch-file - 批处理文件将较新的文件夹复制到其他位置
- ruby-on-rails - Rails 资产管道:自定义字体未加载(哈希未附加到已编译 CSS 中的文件名)
- arrays - 如何一次从数组元组中读取每个数组的第 n 个元素
- python - 布局中的 Kivy 小部件对齐问题
- java - 在带有@FindBy 注释的 InellijIdea 中使用的字段“从未分配”
- r - 根据从第二列得出的频率间隔对 R 中的一列求和
- laravel - Laravel,无法在 auth.basic 中获取用户详细信息
- cross-browser - 当在 Chrome 或其他浏览器中运行时,使在 Firefox 中使用本地 webapp 创建的 localstorage 数据集可供同一个 webapp 访问