pycharm终端运行出现test session starts

调试功能能函数的时候,发现终端窗口不一样。出现了新的运行模式。

终端内容如下:

D:\Anaconda\python.exe "D:\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\pycharm\_jb_pytest_runner.py" --path D:/LSKJ/XXXX/test/1.py
Testing started at 17:10 ...
Launching pytest with arguments D:/LSKJ/XXXX/test/1.py --no-header --no-summary -q in D:\LSKJ\XXXX\test

============================= test session starts =============================
collecting ... collected 1 item

1.py::test_xxxx ERROR                                [100%]
test setup failed
file D:\LSKJ\XXXX\test\1.py, line 14
  def test_xxxx(line_str):
E       fixture 'line_str' not found
>       available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

D:\LSKJ\XXXX\test\1.py:14


========================= 1 warning, 1 error in 5.77s =========================

Process finished with exit code 1

百度了下。。。

原来是进入了pycharm的测试用例模式。

解决办法:

1.检查测试函数名称 是否以 ‘test’ 开头;

2.检查测试类名称 是否以‘Test’开头,但是类中不能有init方法;

3.检查测试文件名称是否以‘test’/‘Test’开头,或者以‘test’/‘Test’结尾。

  • 5
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值