summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-02 12:47:07 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-02 12:47:07 (GMT)
commitbce9a5d5cd783e116fe404c438cb08fc391be111 (patch)
treebf33064aaad00be8a54a6db0de1458efe763d4db
parent02bf701b25b6519422c12dd546be348abe07f032 (diff)
downloadcpython-bce9a5d5cd783e116fe404c438cb08fc391be111.zip
cpython-bce9a5d5cd783e116fe404c438cb08fc391be111.tar.gz
cpython-bce9a5d5cd783e116fe404c438cb08fc391be111.tar.bz2
#17334: test_index now works with unittest test discovery. Patch by Zachary Ware.
-rw-r--r--Lib/test/test_index.py29
-rw-r--r--Misc/NEWS3
2 files changed, 11 insertions, 21 deletions
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index 7a94af1..66eedaa 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -56,7 +56,7 @@ class BaseTestCase(unittest.TestCase):
self.assertRaises(TypeError, slice(self.n).indices, 0)
-class SeqTestCase(unittest.TestCase):
+class SeqTestCase:
# This test case isn't run directly. It just defines common tests
# to the different sequence types below
def setUp(self):
@@ -126,7 +126,7 @@ class SeqTestCase(unittest.TestCase):
self.assertRaises(TypeError, sliceobj, self.n, self)
-class ListTestCase(SeqTestCase):
+class ListTestCase(SeqTestCase, unittest.TestCase):
seq = [0,10,20,30,40,50]
def test_setdelitem(self):
@@ -182,19 +182,19 @@ class NewSeq:
return self._list[index]
-class TupleTestCase(SeqTestCase):
+class TupleTestCase(SeqTestCase, unittest.TestCase):
seq = (0,10,20,30,40,50)
-class ByteArrayTestCase(SeqTestCase):
+class ByteArrayTestCase(SeqTestCase, unittest.TestCase):
seq = bytearray(b"this is a test")
-class BytesTestCase(SeqTestCase):
+class BytesTestCase(SeqTestCase, unittest.TestCase):
seq = b"this is a test"
-class StringTestCase(SeqTestCase):
+class StringTestCase(SeqTestCase, unittest.TestCase):
seq = "this is a test"
-class NewSeqTestCase(SeqTestCase):
+class NewSeqTestCase(SeqTestCase, unittest.TestCase):
seq = NewSeq((0,10,20,30,40,50))
@@ -237,18 +237,5 @@ class OverflowTestCase(unittest.TestCase):
self.assertRaises(OverflowError, lambda: "a" * self.neg)
-def test_main():
- support.run_unittest(
- BaseTestCase,
- ListTestCase,
- TupleTestCase,
- BytesTestCase,
- ByteArrayTestCase,
- StringTestCase,
- NewSeqTestCase,
- RangeTestCase,
- OverflowTestCase,
- )
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
index 83c38ec..983c1cc 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -644,6 +644,9 @@ Tests
- Issue #15539: Added regression tests for Tools/scripts/pindent.py.
+- Issue #17334: test_index now works with unittest test discovery.
+ Patch by Zachary Ware.
+
- Issue #17333: test_imaplib now works with unittest test discovery.
Patch by Zachary Ware.