conftest

作者: 星辰_1c3b | 来源:发表于2019-11-17 17:18 被阅读0次

    在conftest.py文件中的pytest修饰器:

    @pytest.fixture(scope='session')#做标志,确定使用域
    #定义一个方法获取token,方法返回值为token
    def token():
        url = 'http://www.guoyasoft.com:8084/login'
        req = {
            "pwd": "9CBxL4j0",
            "userName": "kanglc23"
        }
        resp = request_tool.post_json(url, json=req)
        resp_json = json.loads(resp.text)
        token = resp_json['data']['token']
        return token
    

    相关文章

      网友评论

          本文标题:conftest

          本文链接:https://www.haomeiwen.com/subject/thopictx.html