首页 > 解决方案 > 使用 tox 执行家庭助理测试用例不起作用

问题描述

我已经在我的ubuntu18.04上安装了python3.7并尝试运行家庭助手测试用例,python和所有依赖项的安装成功,

所以在安装python3.7时,它内部安装了各种用于开发和测试python代码的包。其中一个包typing是内部安装的。(从 python 3.5 开始默认添加打字)

在执行这些测试用例时,我遇到了一个错误。

File "/home/phil/repos/core/.tox/py38/lib/python3.8/site-packages/typing.py", line 1357, in <module>
      class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
    File "/home/phil/repos/core/.tox/py38/lib/python3.8/site-packages/typing.py", line 1005, in __new__
      self._abc_registry = extra._abc_registry
  AttributeError: type object 'Callable' has no attribute '_abc_registry'
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/phil/repos/core/.tox/py38/bin/python /home/phil/repos/core/.tox/py38/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-pqbbs22j/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

SO question 55833509上提供的一种解决方案是pip uninstall typing,它也不起作用。

  1. 有没有办法我也可以卸载这个默认typing包?
  2. 我们可以阻止安装这个typing包吗?
  3. 解决此问题的任何其他解决方案?

标签: pythonpython-3.7toxhome-assistant

解决方案


tox在虚拟环境中运行。因此,删除typing将无济于事。

我假设您script/setup在克隆存储库后安装了系统的依赖项。

tox -r届时将重建环境。


推荐阅读