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: test_argparse --version test cases
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: berker.peksag, bethard, martin.panter, paul.j3, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-12-16 05:12 by martin.panter, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue23062.diff berker.peksag, 2014-12-16 06:17 review
Messages (9)
msg232712 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-12-16 05:12
In Lib/test/test_argparse.py:

class TestHelpVersionOptional(HelpTestCase):
    """Test that the --version argument can be suppressed help messages"""

Assuming that the docstring means something like “. . . can be suppressed _in_ help messages”, the test is wrong, because the --version option is present in the expected output. Maybe it is missing a help=SUPPRESS option? Otherwise it seems this test class would be largely redundant with TestHelpVersionAction.

It also looks like the “version” attribute of the test classes is not used.
msg232714 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-12-16 06:17
I think that your analysis is correct. Also, looks like the original test is problematic: https://code.google.com/p/argparse/source/browse/test/test_argparse.py#3710

Here is a patch to fix the test.
msg232853 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-12-18 03:42
Patch looks sensible enough to me
msg236876 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-02-28 11:21
Why the test class is moved?
msg236898 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-02-28 17:28
> Why the test class is moved?

Just wanted to group all TestHelp* tests together.
msg236900 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-02-28 18:00
But it already was between two help tests: TestHelpNoHelpOptional and TestHelpNone.

I think that original test tested that the help attribute is optional for the --version argument and default description is printed in help output. This test shouldn't be removed.
msg238977 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-03-23 04:27
Serhiy, there is already a test for that:

class TestHelpVersionAction(HelpTestCase):
    """Test the default help for the version action"""

So I still think the test is redundant, unless it is made to exercise help=SUPPRESS, as Berker’s patch does.
msg238985 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-23 07:36
I should agree with you. Then the patch LGTM.
msg240417 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-10 13:11
New changeset 5b728310edac by Berker Peksag in branch '3.4':
Issue #23062: Add a test for suppressing --version with argparse.SUPPRESS.
https://hg.python.org/cpython/rev/5b728310edac

New changeset 157b59609cbd by Berker Peksag in branch 'default':
Issue #23062: Add a test for suppressing --version with argparse.SUPPRESS.
https://hg.python.org/cpython/rev/157b59609cbd
History
Date User Action Args
2022-04-11 14:58:11adminsetgithub: 67251
2015-04-10 13:12:01berker.peksagsetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2015-04-10 13:11:20python-devsetnosy: + python-dev
messages: + msg240417
2015-03-23 07:36:16serhiy.storchakasetassignee: berker.peksag
messages: + msg238985
stage: patch review -> commit review
2015-03-23 04:27:47martin.pantersetmessages: + msg238977
2015-02-28 18:00:43serhiy.storchakasetmessages: + msg236900
2015-02-28 17:28:46berker.peksagsetmessages: + msg236898
2015-02-28 11:21:34serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg236876
2014-12-18 03:42:33martin.pantersetmessages: + msg232853
2014-12-16 06:17:28berker.peksagsetfiles: + issue23062.diff

type: behavior
versions: + Python 3.4
keywords: + patch
nosy: + bethard, berker.peksag, paul.j3

messages: + msg232714
stage: patch review
2014-12-16 05:12:16martin.pantercreate