求助:pytest-xdist识别Worker后无法收集指定目录测试用例
pytest-xdist 无法收集指定目录测试用例问题
- 单独使用
pytest执行tests/sqlalchemy-dialect-compliance目录下的测试用例无任何问题,该运行方式已稳定使用多年,但添加pytest-xdist后,无论调整何种配置,均无法从该目录收集到测试用例。 - 当前在48核Linux主机的Docker容器中,尝试通过pytest结合pytest-xdist实现CPU并行测试。
- pytest-xdist可正确识别Worker数量,但始终无法收集到任何测试用例,已尝试
dist、tx、numprocesses等多种参数组合。
最近一次执行命令及输出如下:
nox > py.test -s -vvv --dist=each '--tx 4*popen//python=python3.11' --numprocesses=4 tests/sqlalchemy_dialect_compliance === test session starts ============================================================= platform linux -- Python 3.11.6, pytest-8.0.0, pluggy-1.4.0 -- /repo/github.com/googleapis/python-bigquery-sqlalchemy/.nox/compliance/bin/python cachedir: .pytest_cache rootdir: /repo/github.com/googleapis/python-bigquery-sqlalchemy configfile: setup.cfg plugins: xdist-3.5.0, rerunfailures-13.0 4 workers [0 items] scheduling tests via EachScheduling === no tests ran in 0.51s ============================================================ nox > Command py.test -s -vvv --dist=each '--tx 4*popen//python=python3.11' --numprocesses=4 tests/sqlalchemy_dialect_compliance failed with exit code 5 # No tests collected. nox > Session compliance failed.
当设置numprocesses=auto时,工具可识别全部48核,但仍无测试用例被收集:
48 workers [0 items]
已在Python 3.11和3.12版本中进行测试,问题均存在。
内容的提问来源于stack exchange,提问作者E. Ducateme
相关产品推荐
相关产品推荐

