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.

Author chris.jerdonek
Recipients chris.jerdonek, ezio.melotti, inglesp
Date 2012-09-28.13:31:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348839064.27.0.220390614501.issue16055@psf.upfronthosting.co.za>
In-reply-to
Content
> Are you happy for me to write the test?

I had started working on that, but sure, be my guest. :)

You seem to be on the right track.  I didn't find precedent nearby either.  We basically want a C version of unittest's assertRaisesRegex() (but it can be a straight string match).  CHECK_INVALID comes close to that.

I would suggest defining a helper function that accepts an exception type and message text, and that clears the current error if it matches.  If the error doesn't match, you can restore the existing one with PyErr_Restore(), or else call raiseTestError() if there isn't one (similar to CHECK_INVALID).

I was thinking of putting the test right after the call to TESTNAME() in test_long_api(), but maybe you know a better location:

http://hg.python.org/cpython/file/default/Modules/_testcapimodule.c#l313

I'll upload what I had for the pure Python failing test since that portion was finished.
History
Date User Action Args
2012-09-28 13:31:04chris.jerdoneksetrecipients: + chris.jerdonek, ezio.melotti, inglesp
2012-09-28 13:31:04chris.jerdoneksetmessageid: <1348839064.27.0.220390614501.issue16055@psf.upfronthosting.co.za>
2012-09-28 13:31:03chris.jerdoneklinkissue16055 messages
2012-09-28 13:31:03chris.jerdonekcreate