【问题标题】:Is there a way to mock snowflake-connector-python module and mock query that will use the mocked cursor and execute the query?有没有办法模拟 snowflake-connector-python 模块和模拟查询,将使用模拟光标并执行查询?
【发布时间】:2022-08-22 21:51:31
【问题描述】:

我有一个使用凭据生成雪花连接并使用生成的游标执行查询的类。

现在我想编写单元测试来模拟该连接并运行查询。

那可能吗 ?

    标签: python-3.x unit-testing pytest python-mock


    【解决方案1】:

    不确定您是否已经弄清楚了……但是我遇到了这个看起来应该可以工作的 github 脚本:

    https://github.com/edx/edx-prefectutils/blob/master/tests/test_snowflake.py#L33

    【讨论】:

      猜你喜欢
      • 2022-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-20
      • 1970-01-01
      相关资源
      最近更新 更多