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 zach.ware
Recipients ezio.melotti, facundobatista, mark.dickinson, rhettinger, skrah, zach.ware
Date 2013-12-18.18:02:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387389747.72.0.229472245916.issue20008@psf.upfronthosting.co.za>
In-reply-to
Content
Stefan Krah wrote:
> In any case, I would prefer a patch without stylistic changes.
> Elimination of "return" is a personal preference, so are the
> whitespace changes.

The returns were removed in #19572, to reduce false positives in searching for silently skipped tests.  I have no strong opinion on them beyond that; if you want them back I can put them back :)

The whitespace removals are just to make the test module consistent with itself, and I personally think it looks better with the removals.  I can put the blank lines back too if need be.  I don't think there are any stylistic changes that aren't also code changes beyond the blank lines removed.

> Listing the tests explicitly is sometimes helpful, e.g. one can
> comment out tests when tracking down a refleak.

The same can be accomplished by either deleting the test case after it is created (which wouldn't take much more editing of the file than commenting it out), or by using e.g. `python -m test.test_decimal CFormatTest CWhitebox PyDoctests` to run a particular set of tests without having to edit the file at all.  It would also be simple enough to add another command line switch to only run the tests on the specified implementation.

> Curiously enough, testing with a "polluted" context is also useful,
> since all functions must handle contexts with flags that are already
> set.

True, but the real problem I ran into was tests changing the precision of the context, not changing it back, and the next test expecting the original precision (or a test expects a changed precision but gets the original).  I'm fine with losing all of the new 'assertAndClearFlags' calls and the checking of flags (and even traps) in tearDown, but the precision changes cause headaches dependent upon test execution order.  In fact, the only reason the tests pass right now is because of their ordering; if you random.shuffle(test_classes) before run_unittest(*test_classes), a few different failures pop up.

Another option would be to add another command line option to set random flags before each test.

(Note that I'm not terribly attached to either of the new command line options I've suggested in this message.  They're just ideas I've had while thinking about your message, and have an idea how either could be implemented pretty easily if anyone else thought it was worthwhile since the command line parsing structure is already there.  I don't plan to do anything with them without agreement from others.)

> Finally, I *suspect* no one is using the command line arguments any
> more.  They were probably used heavily during the design phase of
> decimal.py.

That may well be.  It doesn't hurt anything to keep them, but it would make the patch quite a bit simpler to remove them.  It might be useful in future though, and doesn't add that much more complexity to the module.
History
Date User Action Args
2013-12-18 18:02:27zach.waresetrecipients: + zach.ware, rhettinger, facundobatista, mark.dickinson, ezio.melotti, skrah
2013-12-18 18:02:27zach.waresetmessageid: <1387389747.72.0.229472245916.issue20008@psf.upfronthosting.co.za>
2013-12-18 18:02:27zach.warelinkissue20008 messages
2013-12-18 18:02:26zach.warecreate