Issue 18971: Use argparse in the profile/cProfile modules (original) (raw)

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:50 admin set github: 63171
2018-07-11 17:43:50 yan12125 set nosy: + yan12125
2017-04-20 15:39:35 louielu set messages: +
2017-04-20 14:56:42 r.david.murray set nosy: + r.david.murraymessages: +
2017-04-20 14:47:05 vstinner set nosy: + vstinnermessages: +
2017-04-20 14:44:05 louielu set nosy: + louielumessages: +
2016-12-01 16:11:57 wolma set nosy: + wolmamessages: + title: calendar -> Use argparse in the profile/cProfile modules
2016-12-01 16:10:46 wolma set title: Use argparse in the profile/cProfile modules -> calendar
2013-09-13 20:56:32 serhiy.storchaka set messages: +
2013-09-13 20:40:11 ezio.melotti set nosy: + ezio.melottimessages: +
2013-09-08 14:48:55 serhiy.storchaka create