[Python-checkins] cpython (merge 3.3 -> default): #16748: merge with 3.3.
ezio.melotti
python-checkins at python.org
Wed Jan 2 20:23:13 CET 2013
http://hg.python.org/cpython/rev/de6bac0a40cc
changeset: 81247:de6bac0a40cc
parent: 81244:6a24dbc4bf49
parent: 81246:008bac4e181c
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Wed Jan 02 21:22:58 2013 +0200
summary:
#16748: merge with 3.3.
files:
Lib/test/test_heapq.py | 35 ++++++-----------------------
Misc/NEWS | 2 +
2 files changed, 10 insertions(+), 27 deletions(-)
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py
--- a/Lib/test/test_heapq.py
+++ b/Lib/test/test_heapq.py
@@ -2,6 +2,7 @@
import sys
import random
+import unittest
from test import support
from unittest import TestCase, skipUnless
@@ -25,8 +26,7 @@
self.assertEqual(getattr(c_heapq, fname).__module__, '_heapq')
-class TestHeap(TestCase):
- module = None
+class TestHeap:
def test_push_pop(self):
# 1) Push 256 random numbers and pop them off, verifying all's OK.
@@ -214,12 +214,12 @@
self.assertRaises(TypeError, data, LE)
-class TestHeapPython(TestHeap):
+class TestHeapPython(TestHeap, TestCase):
module = py_heapq
@skipUnless(c_heapq, 'requires _heapq')
-class TestHeapC(TestHeap):
+class TestHeapC(TestHeap, TestCase):
module = c_heapq
@@ -319,8 +319,7 @@
return chain(map(lambda x:x, R(Ig(G(seqn)))))
-class TestErrorHandling(TestCase):
- module = None
+class TestErrorHandling:
def test_non_sequence(self):
for f in (self.module.heapify, self.module.heappop):
@@ -371,31 +370,13 @@
self.assertRaises(ZeroDivisionError, f, 2, E(s))
-class TestErrorHandlingPython(TestErrorHandling):
+class TestErrorHandlingPython(TestErrorHandling, TestCase):
module = py_heapq
@skipUnless(c_heapq, 'requires _heapq')
-class TestErrorHandlingC(TestErrorHandling):
+class TestErrorHandlingC(TestErrorHandling, TestCase):
module = c_heapq
-#==============================================================================
-
-
-def test_main(verbose=None):
- test_classes = [TestModules, TestHeapPython, TestHeapC,
- TestErrorHandlingPython, TestErrorHandlingC]
- support.run_unittest(*test_classes)
-
- # verify reference counting
- if verbose and hasattr(sys, "gettotalrefcount"):
- import gc
- counts = [None] * 5
- for i in range(len(counts)):
- support.run_unittest(*test_classes)
- gc.collect()
- counts[i] = sys.gettotalrefcount()
- print(counts)
-
if __name__ == "__main__":
- test_main(verbose=True)
+ unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -571,6 +571,8 @@
Tests
-----
+- Issue #16748: test_heapq now works with unittest test discovery.
+
- Issue #10646: Tests rearranged for os.samefile/samestat to check for not
just symlinks but also hard links.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list