还未发布过话题
  • 不知道为啥会报这个错,是解析 json 数据问题么

    ================================== FAILURES ===================================
    ________________________ TestMainExcel.test_mainExcel _________________________

    self =

    @allure.title('测试标题')
    @allure.testcase('测试地址:https://www.imooc.com')
    def test_mainExcel(self):
    excelData = GetData(file_name, sheet_id)
    rows_count = excelData.get_case_lines()
    for i in range(1, rows_count):
    is_run = excelData.get_is_run(i)
    if is_run:
    url = excelData.get_request_url(i)
    method = excelData.get_request_method(i)
    request_data = json.loads(excelData.get_request_data(i))
    header = json.loads(handle_ini.get_value('headerDefault', 'header'))
    expect = excelData.get_expcet_data(i)
    with allure.step('接口请求信息:'):
    allure.attach('接口名:{},接口请求地址:{},接口请求方式:{},接口请求参数:{}'.format(excelData.get_name(i), url, method, request_data))
    res = baseRequest.run_main(method, url, request_data, header)

    res_data = res.json()

    test_case\testRequest\test_mainExcel.py:40:


    venv\lib\site-packages\requests\models.py:898: in json
    return complexjson.loads(self.text, **kwargs)
    E:\python3.6.2\lib\json_init_.py:354: in loads
    return _default_decoder.decode(s)
    E:\python3.6.2\lib\json\decoder.py:339: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())


    self =
    s = 'jsonpcallback({"result":0,"data":"","msg":"\u6210\u529f"})', idx = 0

    def raw_decode(self, s, idx=0):
    """Decode a JSON document from s (a str beginning with
    a JSON document) and return a 2-tuple of the Python
    representation and the index in s where the document ended.

    This can be used to decode a JSON document from a string that may
    have extraneous data at the end.

    """
    try:
    obj, end = self.scan_once(s, idx)
    except StopIteration as err:

    raise JSONDecodeError("Expecting value", s, err.value) from None
    E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    E:\python3.6.2\lib\json\decoder.py:357: JSONDecodeError
    =========================== short test summary info ===========================
    FAILED test_case/testRequest/test_mainExcel.py::TestMainExcel::test_mainExcel
    =================== 1 failed, 4 passed in 217.25s (0:03:37) ===================

    Process finished with exit code 0

  • 百度 装饰器