问题描述
我有一个 docker 容器,其中包含使用鼻子测试运行的测试。我想在其中进行远程调试,以便我可以运行容器并使用 debugpy 我可以执行 python -m debugpy --listen 0.0.0.0:5002 tests.py
where tests.py is
import nose
class test():
def test_something(self,mock_celery_task):
self.assertTrue(True)
print('somehthing')
if __name__ == '__main__':
nose.run(name="tests.unit.tests")
然后在 vscode 中这是我的 launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information,visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0","configurations": [
{
"name": "Python: Remote Attach","type": "python","request": "attach","connect": {
"host": "localhost","port": 5002
},"pathMappings": [
{
"localRoot": "${workspaceFolder}","remoteRoot": "."
}
]
}
]
}
在 vscode 中,它会正确地在 self.assertTrue(True)
行上断点,但它卡在那里。我假设它的问题与此处 setting breakpoints with nosetests --pdb option 现在讨论的问题类似。这里讨论的是通过像 nosetests tests.py -s
这样的命令行运行鼻子,但我不想要那样,因为我想要调试运行文件而不是鼻子测试。帮助?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)