在执行Pytest.fixture时面临以下错误。 TypeError:“ NoneType”对象不可下标
以下错误日志:
=============================== test session starts ============
platform linux -- Python 3.6.8, pytest-4.6.3, py-1.8.0, pluggy-0.12.0
rootdir:
collected 1 item
device_registration_test.py F [100%]
====================================== FAILURES ===========
______________________________ test_device --------------------------
connect_mqtt = <paho.mqtt.client.Client object at 0x7fbd50f26b38>
def test_device_registration(connect_mqtt):
client = connect_mqtt
client.subscribe("ctrl/app/v020/put/dr/")
client.on_message = on_message_dr
client.message_callback_add("ctrl/app/v020/put/dr/", on_message_dr)
> assert msg_json["request"]["id"] == 123
E TypeError: 'NoneType' object is not subscriptable
device_registration_test.py:25: TypeError
============================== 1 failed in 1.13 seconds====================