cpython: b62317fe1a22 (original) (raw)
Mercurial > cpython
changeset 82433:b62317fe1a22 3.3
#17082: test_dbm* now work with unittest test discovery. Patch by Zachary Ware. [#17082]
Ezio Melotti ezio.melotti@gmail.com | |
---|---|
date | Fri, 01 Mar 2013 11:23:28 +0200 |
parents | 42d4a29509c4 |
children | e35c053cc4ec 43ac02b7e322 |
files | Lib/test/test_dbm.py Lib/test/test_dbm_dumb.py Lib/test/test_dbm_gnu.py Lib/test/test_dbm_ndbm.py Misc/NEWS |
diffstat | 5 files changed, 17 insertions(+), 28 deletions(-)[+] [-] Lib/test/test_dbm.py 20 Lib/test/test_dbm_dumb.py 10 Lib/test/test_dbm_gnu.py 7 Lib/test/test_dbm_ndbm.py 5 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/test/test_dbm.py +++ b/Lib/test/test_dbm.py @@ -34,7 +34,7 @@ def delete_files(): test.support.unlink(f) -class AnyDBMTestCase(unittest.TestCase): +class AnyDBMTestCase: _dict = {'0': b'', 'a': b'Python:', 'b': b'Programming', @@ -119,10 +119,6 @@ class AnyDBMTestCase(unittest.TestCase): class WhichDBTestCase(unittest.TestCase):
Actual test methods are added to namespace after class definition.
- def init(self, *args):
unittest.TestCase.__init__(self, *args)[](#l1.18)
- def test_whichdb(self): for module in dbm_iterator(): # Check whether whichdb correctly guesses module name @@ -169,12 +165,16 @@ class WhichDBTestCase(unittest.TestCase) self.d.close() -def test_main():
+def load_tests(loader, tests, pattern):
classes.append(type("TestCase-" + mod.__name__, (AnyDBMTestCase,),[](#l1.32)
classes.append(type("TestCase-" + mod.__name__,[](#l1.33)
(AnyDBMTestCase, unittest.TestCase),[](#l1.34) {'module': mod}))[](#l1.35)
--- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -29,9 +29,6 @@ class DumbDBMTestCase(unittest.TestCase) '\u00fc'.encode('utf-8') : b'!', }
- def test_dumbdbm_creation(self): f = dumbdbm.open(_fname, 'c') self.assertEqual(list(f.keys()), []) @@ -195,11 +192,6 @@ class DumbDBMTestCase(unittest.TestCase) def setUp(self): _delete_files() -def test_main():
--- a/Lib/test/test_dbm_gnu.py +++ b/Lib/test/test_dbm_gnu.py @@ -2,7 +2,7 @@ from test import support gdbm = support.import_module("dbm.gnu") #skip if not supported import unittest import os -from test.support import verbose, TESTFN, run_unittest, unlink +from test.support import verbose, TESTFN, unlink filename = TESTFN @@ -81,8 +81,5 @@ class TestGdbm(unittest.TestCase): self.assertTrue(size1 > size2 >= size0) -def test_main():
--- a/Lib/test/test_dbm_ndbm.py +++ b/Lib/test/test_dbm_ndbm.py @@ -36,8 +36,5 @@ class DbmTestCase(unittest.TestCase): except error: self.fail() -def test_main():