【问题标题】:What is the keyboard shortcut to run all unit tests in the current project in PyDev + Eclipse?在 PyDev + Eclipse 中运行当前项目中的所有单元测试的键盘快捷键是什么?
【发布时间】:2011-01-11 12:09:49
【问题描述】:

我知道 Ctrl + F9 运行单个文件。

如何全部运行?

如果没有,如何绑定一个快捷键?

【问题讨论】:

    标签: eclipse unit-testing pydev python-unittest


    【解决方案1】:

    为什么不:

    • 定义一套测试,或在 ant 脚本中定义一个目标(如文章底部的this one), - 然后关联启动配置(ant 脚本的外部配置)?

    然后您可以使用shortcut to that launch configuration(如this thread)。
    一种解决方案是always launch the last applicationF11Ctrl+F11

    <target name="tests" depends="compile">
      <py-test pythonpath="${src.dir}" dir=".">
        <fileset dir="${src.dir}">
          <include name="**/*Test.py"/>
        </fileset>
      </py-test>
    </target> 
    

    注意:还有其他方法可以将单元测试与pydev集成,如SO问题Continuous unit testing with Pydev (Python and Eclipse)所示

    【讨论】:

      【解决方案2】:

      在 pydev 包资源管理器中单击包含测试的文件夹。然后是运行菜单选项(对我来说不是 f9,而是 cmd+shift+F11 (好的,我在 OSX 上,但我怀疑这会是 ctrl+shift+f11 其他地方)这将运行它可以在子目录中找到的所有测试

      要重复你需要按照 VonC 的回答来做

      然后您可以使用shortcut to that launch configuration(如this thread)。
      一种解决方案是always launch the last applicationF11Ctrl+F11

      【讨论】:

        【解决方案3】:

        转到首选项并输入键以进入键盘快捷键定义页面(我认为它被称为键......抱歉,我的开发机器现在没有)。在此对话框中,您可以搜索命令。查看是否有运行所有测试命令(它可能有助于首先找到您当前正在使用的运行测试)。如果有,请查看快捷方式或定义您自己的快捷方式。

        【讨论】:

          猜你喜欢
          • 2011-04-05
          • 2011-12-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2010-09-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多