Trouble running python unit tests with tox - ImportError for module that is already installed

江枫思渺然 提交于 2020-01-06 09:37:12

问题


I am new to python and am trying to run unit tests for this project: https://github.com/matrix-org/synapse

I am running tox from the top level of the project. I get this error: exceptions.ImportError: No module named pymacaroons

But pymacaroons is already installed using pip. To my knowledge, I only have one version of python. Really stumped here.


回答1:


tox creates its own virtual environments and installs dependencies according to tox.ini. pymacaroons is not listed in tox.ini hence it's not installed. To install it either add pymacaroons to tox.ini (section [testenv], key deps) or add -rrequirements.txt to tox.ini and list pymacaroons in the requirements.txt.



来源:https://stackoverflow.com/questions/46854650/trouble-running-python-unit-tests-with-tox-importerror-for-module-that-is-alre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!