VSCode pytest test discovery fails

后端 未结 10 707
南方客
南方客 2020-12-15 16:25

Pytest test discovery is failing. The UI states:

Test discovery error, please check the configuration settings for the tests

The output window s

10条回答
  •  清歌不尽
    2020-12-15 17:12

    In my case the problem with vscode being unable to discover tests was the coverage module being enabled in the setup.cfg (alternatively this could be a pytest.ini), i.e.

    addopts= --cov  -ra
    

    which caused the test discovery to fail due to low coverage. The solution was to remove that line from the config file.

    Also, as suggested in the documentation:

    You can also configure testing manually by setting one and only one of the following settings to true: python.testing.unittestEnabled, python.testing.pytestEnabled, and python.testing.nosetestsEnabled.

提交回复
热议问题