diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-04 23:22:44 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-04 23:22:44 (GMT) |
commit | b9d4963a989accce30234b7b74bce874c0142209 (patch) | |
tree | 63fa25095a756b9def7c84cf7eb88d68c2412e29 /Lib/unittest/case.py | |
parent | b9c3ed4f82d3551c9906da55ddb8059ac3b5ce94 (diff) | |
download | cpython-b9d4963a989accce30234b7b74bce874c0142209.zip cpython-b9d4963a989accce30234b7b74bce874c0142209.tar.gz cpython-b9d4963a989accce30234b7b74bce874c0142209.tar.bz2 |
Issue #7092: Fix the DeprecationWarnings emitted by the standard library
when using the -3 flag. Patch by Florent Xicluna.
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r-- | Lib/unittest/case.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index 8da5743..2ebf2da 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -746,9 +746,15 @@ class TestCase(object): # not hashable. expected = list(expected_seq) actual = list(actual_seq) - expected.sort() - actual.sort() - missing, unexpected = util.sorted_list_difference(expected, actual) + with warnings.catch_warnings(): + if sys.py3kwarning: + # Silence Py3k warning + warnings.filterwarnings("ignore", + "dict inequality comparisons " + "not supported", DeprecationWarning) + expected.sort() + actual.sort() + missing, unexpected = util.sorted_list_difference(expected, actual) errors = [] if missing: errors.append('Expected, but missing:\n %r' % missing) |