gpt4 book ai didi

visual-studio-code - vs 代码 + pytest : unrecognized arguments: rootdir (on Windows)

转载 作者:行者123 更新时间:2023-12-04 16:45:30 26 4
gpt4 key购买 nike

目标很简单:在 Visual Studio Code 中使用 pytest 运行测试

python 扩展已成功配置测试,测试已成功发现,项目中没有 conftest.py 文件,但是当我开始运行测试时,我得到以下信息:

usage: pytest-script.py [options] [file_or_dir] [file_or_dir] [...]
pytest-script.py: error: unrecognized arguments: --rootdir ./test_reporter.py
inifile: None
rootdir: c:\Users\...\project-dir
Error: TypeError: Cannot read property 'testsuites' of null

为什么 VS 代码会发送“无法识别”的参数?最后一行是什么意思?如何适应这一切?

我在 D: 上使用了来自 Anaconda 的 python 3.7,并在 Anaconda 的脚本目录中设置了 pytest 的绝对路径

  • VS 代码:1.45.1
  • pytest:4.3.1

最佳答案

第二个错误是第一个错误的结果。

第一个错误通过将pytest升级到5.4.2解决

关于visual-studio-code - vs 代码 + pytest : unrecognized arguments: rootdir (on Windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62295043/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com