为什么pytest要求指定--tx

问题描述 投票:0回答:1

经过多次成功的测试后,pytest突然抛出此错误:

$ pytest -vvv -x --internal --oclint -n -32
============================= test session starts ==============================
platform darwin -- Python 3.7.7, pytest-5.4.1, py-1.7.0, pluggy-0.13.1 -- /usr/local/opt/python/bin/python3.7
cachedir: .pytest_cache
rootdir: /Users/pre-commit-hooks/code/pre-commit-hooks, inifile: pytest.ini
plugins: xdist-1.31.0, forked-1.1.3
ERROR: MISSING test execution (tx) nodes: please specify --tx

这是我的pytest.ini:

[pytest]
markers =
    oclint: marks tests as slow (deselect with '-m "not slow"')
    internal: marks tests as checking internal components. Use this if you are developing hooks

-n #来自pytest-xdist,它是pytest的附加组件。这对我来说很奇怪,因为在travis linux构建上的pytest在最后一次迭代之前都可以正常工作。

问题

为什么pytest要求我为测试添加--tx

python pytest travis-ci pytest-xdist
1个回答
0
投票
[如果您在-n后面加一个破折号,例如-n -32,则pytest将抱怨缺少--tx选项。换句话说,-n之后的数字不能为负,而您要使用的是-n 32

--tx通常像这样来调用Python2.7子进程:

pytest -d --tx popen//python=python2.7

有关在pytest中使用--tx的更多信息,请参见pytest-xdist [此标志上的文档](pytest -d --tx popen // python = python2.7)。
© www.soinside.com 2019 - 2024. All rights reserved.