【发布时间】:2021-12-03 03:25:39
【问题描述】:
在 pytest 测试执行期间,我注意到一个警告,指示如下:
/usr/local/lib/python3.6/site-packages/marshmallow/fields.py:222: RemovedInMarshmallow4Warning: Passing field metadata as keyword arguments is deprecated. Use the explicit `metadata=...` argument instead. Additional metadata: {'places': 0}
RemovedInMarshmallow4Warning,
module test_get_record_not_found
/usr/local/lib/python3.6/site-packages/flask/json/__init__.py:211: DeprecationWarning: Importing 'itsdangerous.json' is deprecated and will be removed in ItsDangerous 2.1. Use Python's 'json' module instead.
rv = _json.dumps(obj, **kwargs)
测试是简单的get contact not found:
def test_get_record_not_found(test_client,db_session):
get_resp = test_client.get(
f'/record/0')
get_data = json.loads(get_resp.data.decode())
assert get_resp.status_code == 404
assert 'not found' in get_data['message']
你知道我怎样才能摆脱上述警告吗?
谢谢
【问题讨论】:
标签: python marshmallow