classification
Title: Use specific asserts in optparse test
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.4, Python 2.7
process
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 2017-03-23 18:35 by BreamoreBoy. This issue is now closed.

Files
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/test_argparse.py
--- a/Lib/test/test_argparse.py	Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_argparse.py	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'.
History
Date User Action Args
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