diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-04 23:22:44 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-04 23:22:44 +0000 |
commit | c5604a77f36a02ec06de2d448d75dba0c985057e (patch) | |
tree | 986fd3d91ee241d4046ff4daca5eb7f503650f99 /Lib/unittest | |
parent | e64e8c41e7724fd41b8c1391b1f0de80a79e48a8 (diff) | |
download | cpython-c5604a77f36a02ec06de2d448d75dba0c985057e.tar.gz |
Issue #7092: Fix the DeprecationWarnings emitted by the standard library
when using the -3 flag. Patch by Florent Xicluna.
Diffstat (limited to 'Lib/unittest')
-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 8da5743440..2ebf2da9f3 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) |