在 PyDev 中运行当前项目中所有单元测试的键盘快捷键是什么?蚀?

发布于 2024-08-19 23:18:55 字数 98 浏览 4 评论 0原文

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

如何运行它们?

如果没有这样的东西,如何绑定一个键盘快捷键呢?

I know Ctrl + F9 runs a single file.

How to run them all?

If there is no such thing, how to bind one keyboard shortcut to it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浅忆 2024-08-26 23:18:55

为什么不:

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

然后,您可以使用该启动配置的快捷方式(如在此线程中)。
一种解决方案是始终启动最后一个应用程序F11Ctrl+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 问题 使用 Pydev(Python 和 Eclipse)进行连续单元测试

Why not:

  • define a suite of tests, or a target in an ant script (like this one, at the bottom of the article),
    -and then associate a launch configuration (an external one for the ant script)?

You could then use a shortcut to that launch configuration (as in this thread).
One solution for that is to always launch the last application (F11 or Ctrl+F11 )

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

Note: there are other ways to integrate unit testing with pydev, as shown in SO question Continuous unit testing with Pydev (Python and Eclipse)

ˇ宁静的妩媚 2024-08-26 23:18:55

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

要重复,您需要按照 VonC 的答案进行操作

然后,您可以使用该启动配置的快捷方式(如此线程中所示)。
一种解决方案是始终启动最后一个应用程序F11Ctrl+F11 )

Click on a folder that contains tests in the pydev package explorer. Then the run menu option (which is not f9 for me but cmd+shift+F11 (OK I am on OSX but I suspect this would be ctrl+shift+f11 elsewhere) This runs all the tests it can find in subdirectories

To repeat you need to do as per VonC's answer

You could then use a shortcut to that launch configuration (as in this thread).
One solution for that is to always launch the last application (F11 or Ctrl+F11 )

倥絔 2024-08-26 23:18:55

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

Go to the preferences and type in keys to get to the keyboard shortcut definition page (I think it's called keys... sorry not on my dev machine right now). In this dialog you can search for commands. See if there is a run all tests command (it might help to find the run tests you are currently using first). If there is check out the shortcut or define your own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文