[Python-Dev] regression tests with regrtest.py -r

Guido van Rossum guido@python.org
Sat, 15 Dec 2001 13:01:07 -0500

>   On a lark, I decided to try running the regression tests with -r,

Good idea!

> which tells regrtest.py to run the tests in random order.  With this,
> I get the following warnings from test_long.py:
> ../Lib/test/test_long.py:266: OverflowWarning: integer addition
>   special = [0, 1, 2, 3, sys.maxint-1, sys.maxint, sys.maxint+1]
>   This was with the CVS trunk, which is still virtually identical to
> the 2.2c1 release.
>   I won't have time to look at them this weekend, but this should be
> fixed.  It may be possible there are other order-dependent behaviors,
> so it would be really good if people who have time can run the tests
> with -r on whatever platforms are available and report any other
> anomolies.

I've found the cause: test_scope.py contains a call to
warnings.resetwarnings(), which removes *all* warning filters, not
just those made by the calling module.  Because of the way
OverflowWarning is suppressed, this removes the "preset" filter that
suppresses OverflowWarning.

Since an API redesign before the 2.2 release is out of the question,
I'm fixing this by removing the resetwarnings() call from
test_scope.py and making the filterwarnings() call there a little more

--Guido van Rossum (home page: http://www.python.org/~guido/)