一、问题

在pycharm中运行带有pytest包的代码会出现如下错误:

E       fixture 'a' not found
>       available fixtures: 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.

二、解决办法

1、问题原因

代码中包含了带有test的函数,pycharm自动运行使用的是pytest。
在这里插入图片描述

2、方法

改用python
在这里插入图片描述

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐