← 输入框|bugs.python.org|刷新

➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: Use argparse in the profile/cProfile modules
类型: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.4
process
状态: open Resolution:
Dependencies: 后续:
分配给: 抄送列表: bethard, ezio.melotti, georg.brandl, louielu, r.david.murray, serhiy.storchaka, vstinner, wolma, yan12125
优先级: normal 关键字: patch

serhiy.storchaka 于 2013-09-08 14:48 创建。最近一次由 admin 于 2022-04-11 14:57 修改。

文件
文件名 上传时间 Description 编辑
profile_argparse.patch serhiy.storchaka, 2013-09-08 14:48 review
Messages (8)
msg197262 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) 日期: 2013-09-08 14:48
Here is a patch which replaces optparse to argparse in the profile and cProfile modules.
msg197649 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) 日期: 2013-09-13 20:40
Is the command-line interface covered by tests?
msg197660 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) 日期: 2013-09-13 20:56
No. And I know your next proposition. :-(
msg282192 - (view) Author: Wolfgang Maier (wolma) * 日期: 2016-12-01 16:11
oops, typing in wrong window. Very sorry.
msg291976 - (view) Author: Louie Lu (louielu) * 日期: 2017-04-20 14:44
bad news, somehow the output of std.err and std.out have different between optparse and argparse, even if the test is done, it still need to convert some testcase to argparse compatible.
msg291977 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2017-04-20 14:47
> bad news, somehow the output of std.err and std.out have different between optparse and argparse

Only test argparse. I don't think that it matters to test that the change doesn't change the behaviour.

You can also redirect stderr to stdout.

What do you want to test?
msg291978 - (view) Author: R. David Murray (r.david.murray) * (Python committer) 日期: 2017-04-20 14:56
Well, part of the point of the tests is to make sure the module's behavior doesn't change when doing the conversion to argparse.  But "behavior changing" doesn't extend to the exact format of the output...that can change, as long as what the module *does* given specific cli argument combinations stays the same.  Ideally, you write the tests so that it is not sensitive to the exact output, but realistically some tests may need to be different between the optparse case and the argparse case to get good coverage.

Note that even with good tests, you can still miss behavior changes.  We tried to do a good job on the tests for compileall, for example, and we still introduced a bug or two when we converted to argparse.
msg291982 - (view) Author: Louie Lu (louielu) * 日期: 2017-04-20 15:39
haypo, murray, thanks for pointing this thing, I will let go about the bad message test, move to output file and sort test tomorrow, also add a new issue: #30118
历史
日期 用户 动作 参数
2022-04-11 14:57:50admin修改github: 63171
2018-07-11 17:43:50yan12125修改抄送: + yan12125
2017-04-20 15:39:35louielu修改消息: + msg291982
2017-04-20 14:56:42r.david.murray修改抄送: + r.david.murray
消息: + msg291978
2017-04-20 14:47:05vstinner修改抄送: + vstinner
消息: + msg291977
2017-04-20 14:44:05louielu修改抄送: + louielu
消息: + msg291976
2016-12-01 16:11:57wolma修改抄送: + wolma

消息: + msg282192
标题: calendar -> Use argparse in the profile/cProfile modules
2016-12-01 16:10:46wolma修改标题: Use argparse in the profile/cProfile modules -> calendar
2013-09-13 20:56:32serhiy.storchaka修改消息: + msg197660
2013-09-13 20:40:11ezio.melotti修改抄送: + ezio.melotti
消息: + msg197649
2013-09-08 14:48:55serhiy.storchaka创建