- pytest 第一个程序
import requests
import pytest
class TestV2Api(object):
domain = "https://www.v2ex.com/"
@pytest.mark.timeout(2)
def test_user_reg(self):
path = "api/nodes/show.json?name=python"
url = TestV2Api.domain + path
res = requests.get(url).json()
assert res["id"] == 90
assert res["name"] == "python"
assert "语言编程话题" in res["header"]
教程后续更新