如何解决当通过 `nose.run` 运行时,`nosetests -s` 的等价物是什么?
我有一个 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 举报,一经查实,本站将立刻删除。