linux怎么执行自动化测试,[求助] 在 Linux 下执行 web 自动化测试,pytest 报错了,大家帮忙看看这是啥问题啊?...

在使用Python进行测试时遇到内部错误,源于`capture_screenshot`函数中尝试对NoneType对象调用save_screenshot方法。问题可能出现在测试代码中conftest.py的截图捕获部分。
摘要由CSDN通过智能技术生成

[root@XXXX]# python run.py

=========================================== testsession starts ===========================================

platform linux -- Python 3.7.4, pytest-5.2.2, py-1.10.0, pluggy-0.13.1

rootdir: /data/XXXX, inifile: pytest.ini

plugins: allure-pytest-2.8.16, html-2.1.1, metadata-1.11.0

collecting ... http://XXXX.net/

TGT

collected 21 items

TestCase/test_home.py

INTERNALERROR> Traceback (most recent call last):

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/_pytest/main.py", line 193, inwrap_session

INTERNALERROR> session.exitstatus = doit(config, session) or 0

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/_pytest/main.py", line 237, in_main

INTERNALERROR> config.hook.pytest_runtestloop(session=session)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in__call__

INTERNALERROR> returnself._hookexec(self, self.get_hookimpls(), kwargs)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/manager.py", line 93, in_hookexec

INTERNALERROR> returnself._inner_hookexec(hook, methods, kwargs)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/manager.py", line 87, in

INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") ifhook.spec elseFalse,

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/callers.py", line 208, in_multicall

INTERNALERROR> returnoutcome.get_result()

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/callers.py", line 80, inget_result

INTERNALERROR> raise ex[1].with_traceback(ex[2])

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/callers.py", line 187, in_multicall

INTERNALERROR> res = hook_impl.function(*args)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/_pytest/main.py", line 258, inpytest_runtestloop

INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in__call__

INTERNALERROR> returnself._hookexec(self, self.get_hookimpls(), kwargs)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/manager.py", line 93, in_hookexec

INTERNALERROR> returnself._inner_hookexec(hook, methods, kwargs)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/manager.py", line 87, in

INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") ifhook.spec elseFalse,

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/callers.py", line 208, in_multicall

INTERNALERROR> returnoutcome.get_result()

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/callers.py", line 80, inget_result

INTERNALERROR> raise ex[1].with_traceback(ex[2])

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/callers.py", line 187, in_multicall

INTERNALERROR> res = hook_impl.function(*args)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/_pytest/runner.py", line 80, inpytest_runtest_protocol

INTERNALERROR> runtestprotocol(item, nextitem=nextitem)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/_pytest/runner.py", line 89, inruntestprotocol

INTERNALERROR> rep = call_and_report(item, "setup", log)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/_pytest/runner.py", line 178, incall_and_report

INTERNALERROR> report = hook.pytest_runtest_makereport(item=item, call=call)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in__call__

INTERNALERROR> returnself._hookexec(self, self.get_hookimpls(), kwargs)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/manager.py", line 93, in_hookexec

INTERNALERROR> returnself._inner_hookexec(hook, methods, kwargs)

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/manager.py", line 87, in

INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") ifhook.spec elseFalse,

INTERNALERROR> File "/usr/local/python3/lib/python3.7/site-packages/pluggy/callers.py", line 203, in_multicall

INTERNALERROR> gen.send(outcome)

INTERNALERROR> File "/data/XXXX/conftest.py", line 73, inpytest_runtest_makereport

INTERNALERROR> screen_img = _capture_screenshot()

INTERNALERROR> File "/data/XXXX/conftest.py", line 149, in_capture_screenshot

INTERNALERROR> driver.save_screenshot(screen_path)

INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'save_screenshot'

========================================== no tests ran in0.25s =========================================

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值