测试积点老人 发表于 2022-6-8 10:23:47

pytest中没有发现测试 ,空套件,返回代码为5

代码:
mport openpyxl
import pytest
from page.env_elements import Elements
from logic.login_tp import Login

def get_excel():
case = openpyxl.load_workbook('C:/Users/57890/Desktop/demo1.xlsx')
sheet = case.active
vlaues = []
for row in sheet:
line = []
for cell in row:
line.append(cell.value)
vlaues.append(line)
print(vlaues)
return vlaues

class Login_test:
@pytest.mark.parametrize('username,password', get_excel())
def test_case01(self, username, password):
action = Login()
action.login_tpshop(username, password)
assert '安全退出' in action.get_text(Elements.SAFEQUIT_BUTTON)

if name == 'main':
pytest.main(['-s'])结果:进程已结束,退出代码为 5空套件

qqq911 发表于 2022-6-9 10:39:22

下个断点看下

kallinr 发表于 2022-6-9 11:10:53

debug一下
页: [1]
查看完整版本: pytest中没有发现测试 ,空套件,返回代码为5