import pytest import allure import requests class TestSimple(object): def TestWatcher(self): url = "http://wthrcdn.etouch.cn/weather_mini?city=成都" r = requests.get(url) assert r.status_code == 200 d = r.json() print(d)
结果问题查询:pytest 启动文件名是以test开头,函数名是以test开头。所以我们把上面的函数名改下,把TestWacher改为testWacher再去执行,效果如下: