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
Title: Use argparse in the profile/cProfile modules
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: bethard, ezio.melotti, georg.brandl, louielu, r.david.murray, serhiy.storchaka, vstinner, wolma, yan12125
Priority: normal Keywords: patch

Created on 2013-09-08 14:48 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
profile_argparse.patch serhiy.storchaka, 2013-09-08 14:48 review
Messages (8)
msg197262 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 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) Date: 2013-09-13 20:40
Is the command-line interface covered by tests?
msg197660 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-13 20:56
No. And I know your next proposition. :-(
msg282192 - (view) Author: Wolfgang Maier (wolma) * Date: 2016-12-01 16:11
oops, typing in wrong window. Very sorry.
msg291976 - (view) Author: Louie Lu (louielu) * Date: 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) Date: 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) Date: 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) * Date: 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
History
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63171
2018-07-11 17:43:50yan12125setnosy: + yan12125
2017-04-20 15:39:35louielusetmessages: + msg291982
2017-04-20 14:56:42r.david.murraysetnosy: + r.david.murray
messages: + msg291978
2017-04-20 14:47:05vstinnersetnosy: + vstinner
messages: + msg291977
2017-04-20 14:44:05louielusetnosy: + louielu
messages: + msg291976
2016-12-01 16:11:57wolmasetnosy: + wolma

messages: + msg282192
title: calendar -> Use argparse in the profile/cProfile modules
2016-12-01 16:10:46wolmasettitle: Use argparse in the profile/cProfile modules -> calendar
2013-09-13 20:56:32serhiy.storchakasetmessages: + msg197660
2013-09-13 20:40:11ezio.melottisetnosy: + ezio.melotti
messages: + msg197649
2013-09-08 14:48:55serhiy.storchakacreate