首页 > 解决方案 > 是否有教程如何抑制 Squish 的 Pylint 警告?

问题描述

我试图抑制来自 Squish 的 Pylint 警告,但没有在代码前面编写相同的代码,如下所述:https ://kb.froglogic.com/display/KB/Example+-+Using+PyLint+with+Squish +test+scripts+that+use+source%28%29

我想知道是否是我可以配置并上传到 Squish 的文件

标签: pylintsquish

解决方案


本文描述了唯一的选择,即自己定义 Squish 函数和符号。

但是,为了简单起见,它仅显示了在单个文件 Squish 测试脚本文件中执行的操作。

您当然应该将这些 Squish 函数定义放在一个单独的、可重用的文件中,并使用 import 将定义“加载”到您的 test.py 文件中:

from squish_definitions import *

def main():
    ...

在 squish_definitions.py 中:

# Trick Pylint and Python IDEs into accepting the
# definitions in this block, whereas upon execution
# none of these definitions will take place:
if -0:
    class ApplicationContext:
        pass

    def startApplication(aut_path_or_name, optional_squishserver_host, optional_squishserver_port):
        return ApplicationContext

    # etc.

此外,您通常应该切换到使用 Python 的导入来支持 Squish 的 source() 函数。


推荐阅读