【发布时间】:2021-05-24 04:49:10
【问题描述】:
我正在尝试为 python 编程设置我的 VScode 环境(我直到现在才使用它来编写 c++ 代码)。我设置了非常简单的“Hello world”程序并为它编写了虚拟测试:
from problems.hello_world import HelloWorld
class SimpleTest():
def setUp(self):
self.hello = HelloWorld()
def test_dummy(self):
self.assertEqual(True,False)
这个测试是通过,这是错误的,它应该失败!但是我的 VScode 抱怨(在我调用 assertEqual 的最后一行)Instance of 'SimpleTest' has no 'assertEqual' member pylint (no-member)。
它还在导入行中抱怨 Unable to import 'problems.hello_world'pylint(import-error) 。
我的 python 二进制文件和 python 测试都在同一个名为问题的文件夹中。
我正在使用 bazel build 和 python 3.7 版本。我无法弄清楚我的 VScode python 设置有什么问题,或者是什么问题。使用 c++ 环境,它可以完美运行。 在我的工作区 settings.json 中,我启用了 pylint,这是它的内容:
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
}
这只是我的 settings.json 文件中的两行。对于我的 c++ 程序,我使用单独的工作区(可能是问题所在?)。 感谢您的帮助!
【问题讨论】:
标签: python visual-studio-code vscode-settings pylint