如何摆脱这个恼人的错误?我不明白它要我做什么。 当我尝试运行测试时会发生这种情况 单击“运行”后出现以下结果 屏幕 单击“仍然继续”即可正常运行测试。 那么我应该怎么做才能阻止每次运行测试时弹出此窗口?
更新: 这是我同时发现的自己: 从这里
if (targetType == PyRunTargetVariant.PYTHON && !isWellFormed()) {
throw RuntimeConfigurationError("Provide a qualified name of function, class or a module")
}
函数 isWellFormed() 声明来自 here
/**
* Sanity check for "target" value. Does not resolve target, only check its syntax
* CUSTOM type is not checked.
*/
fun TargetWithVariant.isWellFormed() = when (targetVariant) {
PyRunTargetVariant.PYTHON -> Regex("^[a-zA-Z0-9._]+[a-zA-Z0-9_]$").matches(target ?: "")
PyRunTargetVariant.PATH -> !VfsUtil.isBadName(target)
else -> true
}
使用我的测试类和方法名称的正则表达式,一切看起来都很好。
好吧,这真的很奇怪。 我仔细查看了正则表达式,发现它在目标路径中不需要任何“-”。因此,将文件名从 ads_wrapper-tests.py 重命名为 ads_wrapper_tests.py 解决了问题,并且窗口不再弹出。
有了这个问题错误:提供函数、类或模块的限定名称刚刚得到修复,很快 Pycharm 将允许在目标名称中使用所有有效的标识符名称。