不懂就问, VS CODE 单文件 Python 调试

2020-06-19 21:00:45 +08:00
 conghuiwang
新建一个 py 文件,输入如下代码:

print("hello,world")

右键 Run Current Test File 点击无反应,无输出。
右键 Run Python File in Terminal 点击运行,有输出。

那么问题来了,Run Current Test File 到底是做什么的?
1362 次点击
所在节点    Visual Studio Code
3 条回复
CNife
2020-06-20 09:23:21 +08:00
https://code.visualstudio.com/docs/python/testing#_run-tests

Run Current Test File 是 Runs the test in the file that's currently viewed in the editor.

这个功能是用来适配 unittest 、pytest 、nose 这些测试框架的,你这个文件不是 Test File,自然没反应。

想调试,打好断点,按 F5,选择 Python File 即可。
conghuiwang
2020-06-20 21:01:15 +08:00
Thanks.
这个菜单项,好奇怪。
conghuiwang
2020-06-20 21:01:30 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/683168

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX