简体   繁体   English

如何使用Docker Python解释器在PyCharm中的调试中执行测试?

[英]How can I execute my tests in Debug in PyCharm using a Docker Python Interpreter?

I configured PyCharm Python Interpreter as a remote Docker Python Interpreter: 我将PyCharm Python解释器配置为远程Docker Python解释器:

在此处输入图片说明

I do not have any problem to run my tests using this configuration. 使用此配置运行我的测试没有任何问题。

But when I try to run them in Debug , execution freeze to this waiting for connection... status: 但是,当我尝试在Debug运行它们时,执行会冻结到此waiting for connection...状态:

在此处输入图片说明

So my questions are: 所以我的问题是:

  • What am I doing bad? 我在做什么不好?
  • How can I execute my tests in Debug in PyCharm using a Docker Python Interpreter ? 如何使用Docker Python解释器在PyCharm中的调试中执行测试?

This problem is due to pydevd hardcoded host ip address in PyCharm sources ( 10.0.0.2 ). 此问题是由于PyCharm源( 10.0.0.2 )中的pydevd硬编码的主机ip地址引起的。

So if you do not use VirtualBox to manage and run your docker-machine , you will not be able to easily launch your tests in debug. 因此,如果您不使用VirtualBox来管理和运行docker-machine ,则将无法轻松地在调试中启动测试。

It should be patched in PyCharm 2016.3 for docker interpreter and in PyCharm 2016.3.1 for docker-compose interpreter . 应该在PyCharm 2016.3 docker interpreterPyCharm 2016.3.1PyCharm 2016.3.1 docker-compose interpreter PyCharm 2016.3进行修补。

Awaiting this release, a workaround exist here, on JetBrain website . 等待此版本, JetBrain网站上存在解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PyCharm远程解释器:无法执行Docker的Python二进制文件 - PyCharm Remote Interpreter: Cannot Execute Docker's Python Binary 将 PyCharm Python 解释器设置为 Docker - Set PyCharm Python interpreter to Docker PyCharm 远程调试使用远程容器 Python 解释器 - PyCharm remote debug using remote container Python interpreter 如何将解释器添加到 PyCharm? - How can I add interpreter to PyCharm? 在使用Python解释器运行脚本之前,如何执行一堆Python命令? - How can I execute a bunch of Python commands before a script is run when using the Python interpreter? py2app:如何使用捆绑的python解释器运行测试? - py2app: How can I run tests using the bundled python interpreter? 在远程 python 3 解释器周围使用包装器时,如何在 Pycharm 中禁用 python 2.7 代码兼容性错误消息? - How can I disable python 2.7 code compatibility error message in Pycharm when using wrapper around remote python 3 interpreter? 如何将PyCharm连接到位于Docker容器内的python解释器? - How to connect PyCharm to a python interpreter located inside a Docker container? 如何在使用 PyCharm 的远程计算机上调试从 Python 调用的 C++ 代码? - How can I debug C++ code called from Python on a remote machines using PyCharm? 如何在 PyCharm 中调试外部 python package - How can I debug external python package in PyCharm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM