为什么Tox面临Pytest版本冲突?

时间:2019-04-12 19:15:06

标签: python travis-ci pytest tox

我将寻求帮助,因为对非常相似的问题[1][2]的回答无法帮助我解决问题。

tox在我的本地环境中运行无错误,但是在travis ci中具有相同版本的toxpytest等,它引发以下异常:

pluggy.manager.PluginValidationError: Plugin 'removestalebytecode' could not be loaded: (pytest 4.4.0 (XXX/.tox/py35/lib/python3.5/site-packages), Requirement.parse('pytest<3.10'))!

来了 pytest 4.4.0 来自何处?
pytest --version shows版本3.7.4,由pip install 'pytest~=3.7.0' --force-reinstall travis ci setup明确安装。

1 个答案:

答案 0 :(得分:0)

  

pytest 4.4.0来自何处?

tox完全独立于pip install 'pytest~=3.7.0' --force-reinstall

进行安装

可以通过将tox环境坚持到pytest中特定的tox.ini版本来解决

[py]
deps=
    pytest<3.10
    ...

它不能解决问题

pluggy.manager.PluginValidationError: Plugin 'removestalebytecode' could not be loaded: (pytest 4.4.0 (XXX/.tox/py35/lib/python3.5/site-packages), Requirement.parse('pytest<3.10'))!

因为当前版本为3.0.1 pytest-remove-stale-bytecode,该插件不适用于py.test 3.10。

要解决此问题tox.ini 应限制 pytest-remove-stale-bytecode

的版本
[py]
deps=
    ...
    pytest-remove-stale-bytecode<3.0.1