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.

Title: Use specific asserts in optparse test
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.4, Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, paul.j3, serhiy.storchaka
Priority: low Keywords: patch

Created on 2014-02-07 21:34 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
test_optparse_asserts.patch serhiy.storchaka, 2014-02-07 21:34 review
Pull Requests
URL Status Linked Edit
PR 786 closed serhiy.storchaka, 2017-03-23 17:05
Messages (4)
msg210560 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-07 21:34
The proposed patch makes argparse and optparse modules tests use more specific asserts. This will provide more useful failure report.
msg221998 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-07-01 00:08
diff -r 3b94a4ef244e Lib/test/
--- a/Lib/test/	Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/	Fri Feb 07 22:34:13 2014 +0200
@@ -4219,7 +4219,7 @@
             e = sys.exc_info()[1]
             expected = 'unknown action'
             msg = 'expected %r, found %r' % (expected, e)
-            self.assertTrue(expected in str(e), msg)
+            self.assertIn(expected, str(e), msg)

The patch in issue 9554 replaces this code with assertRaises and assertRegex (I will change the code to use assertRaisesRegex).
msg222380 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-05 23:52
I don't object to these changes but I don't see much sense in them as optparse has been deprecated since 2.7/3.2.
msg264969 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-05-06 12:10
The patch looks simple, but I don't see much gain to apply it since optparse is a deprecated module. I'm in favor of closing this as 'wont fix'.
Date User Action Args
2022-04-11 14:57:58adminsetgithub: 64753
2017-03-23 18:35:37BreamoreBoysetnosy: - BreamoreBoy
2017-03-23 17:05:29serhiy.storchakasetpull_requests: + pull_request691
2016-05-06 12:16:44serhiy.storchakasetstatus: open -> closed
resolution: wont fix
stage: patch review -> resolved
2016-05-06 12:10:07berker.peksagsetpriority: normal -> low

messages: + msg264969
2014-07-05 23:52:50BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222380
2014-07-01 01:38:37paul.j3setnosy: + paul.j3
2014-07-01 00:08:11berker.peksagsetnosy: + berker.peksag
title: Use specific asserts in argparse and optparse tests -> Use specific asserts in optparse test
messages: + msg221998

stage: patch review
2014-02-07 21:36:36serhiy.storchakalinkissue16510 dependencies
2014-02-07 21:34:19serhiy.storchakacreate