问题一:
运行“E:/PycharmProjects/teach/test_case/test_Login.py”目录下的代码报错:
"E:\Program Files\Python36-32\python.exe" E:/PycharmProjects/teach/test_case/test_Login.py
Traceback (most recent call last):
File "E:/PycharmProjects/teach/test_case/test_Login.py", line 19, in <module>
@pytest.mark.parametrize('inData, repsData', get_excelData('1-登录接口', 2, 6, 6, 8))
File "E:\PycharmProjects\teach\Lib\Api\GetExcelData.py", line 20, in get_excelData
dataList.append(cellData, repsCellData)
TypeError: append() takes exactly one argument (2 given)
问题原因:
GetExcelData.py,第20行代码,dataList.append(cellData, repsCellData)--少一层括号,导致test_case.py第19行代码方法错误
解决方案:
GetExcelData.py,第20行代码,dataList.append((cellData, repsCellData))
问题二:
运行“E:/PycharmProjects/teach/test_case/test_Lesson.py”目录下test_Lesson.py的代码报错:
"E:\Program Files\Python36-32\python.exe" E:/PycharmProjects/teach/test_case/test_Lesson.py
File "E:/PycharmProjects/teach/test_case/test_Lesson.py", line 20
def test_add_lesson(self,inData,repsData):
^
SyntaxError: invalid syntax---语法错误
问题原因:
test_Lesson.py代码此行@pytest.mark.parametrize('inData, repsData', get_excelData('2-课程模块', 2, 26, 6, 8)最后面少一个括号
解决方案:
最后的地方添加括号:@pytest.mark.parametrize('inData, repsData', get_excelData('2-课程模块', 2, 26, 6, 8))
【注释】
当出现“SyntaxError: invalid syntax”错误提示,请查看错误行及上下行的标点符号,是否缺少或为中文,或有多余的空格等问题
网友评论