微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当通过 `nose.run` 运行时,`nosetests -s` 的等价物是什么?

如何解决当通过 `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 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?