我正在模拟一个内部函数,它返回dynamodb查询。查询有begins_with,它正在抛出错误IndexError: list index out of range。我更改了查询并删除了begins_with,但仍然得到了相同的错误。如果我删除了AND condition from KeyConditionExpression,那么查询就能工作了。import json_util as dynamodb_jsonfrom contextlib import context
我使用pytest和dynamoDB表编写了命令和查询的测试,这些测试都是用我编写的一个夹具编写的,而且它可以工作。test_event.json (我需要requestContext字段)用命令测试端点:我得到以下错误calling the Query operation: The table does not have the specified index: GS1PK-GS1SK-index
因此,显然没有加
- template.yamlimport boto3
db = boto3.resource("dynamodb")当我运行pytest并触发test_hello_world.py时,问题就出现了。我得到以下错误:src/hello_world/hello_world.py:1: in <module>
ImportError: cannot import name 'db_con
我正在通过Python脚本运行pytest,我希望它知道pytest是否失败。对我来说,直观的方法是在pytest的出口上捕捉到任何stderr,但是我似乎找不到一个方法。有小费吗?test_2(): object.func()这些测试的名称如下:我想知道一个断言是否已经失败,并为此做些什么,也许是这样:
e