[test] Use stdlib doctest module instead of logilab-common class
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 19 Jan 2016 16:44:34 +0100
changeset 11078 de4367ef4e5e
parent 11077 09be48c01fa4
child 11085 2c0541b6803f
[test] Use stdlib doctest module instead of logilab-common class The former just works fine now but the later does not play well with py.test.
cubicweb/test/unittest_uilib.py
cubicweb/test/unittest_utils.py
--- a/cubicweb/test/unittest_uilib.py	Thu Jan 14 17:42:22 2016 +0100
+++ b/cubicweb/test/unittest_uilib.py	Tue Jan 19 16:44:34 2016 +0100
@@ -21,6 +21,7 @@
 __docformat__ = "restructuredtext en"
 
 
+import doctest
 import pkg_resources
 
 try:
@@ -28,7 +29,7 @@
 except ImportError:
     from unittest2 import skipIf
 
-from logilab.common.testlib import DocTest, TestCase, unittest_main
+from logilab.common.testlib import TestCase, unittest_main
 
 from cubicweb import uilib, utils as cwutils
 
@@ -194,8 +195,10 @@
         self.assertMultiLineEqual(uilib.soup2xhtml(incoming, 'ascii'), expected)
 
 
-class DocTest(DocTest):
-    module = uilib
+def load_tests(loader, tests, ignore):
+    import cubicweb.utils
+    tests.addTests(doctest.DocTestSuite(uilib))
+    return tests
 
 
 if __name__ == '__main__':
--- a/cubicweb/test/unittest_utils.py	Thu Jan 14 17:42:22 2016 +0100
+++ b/cubicweb/test/unittest_utils.py	Tue Jan 19 16:44:34 2016 +0100
@@ -17,13 +17,14 @@
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """unit tests for module cubicweb.utils"""
 
-import re
+import datetime
 import decimal
-import datetime
+import doctest
+import re
 
 from six.moves import range
 
-from logilab.common.testlib import TestCase, DocTest, unittest_main
+from logilab.common.testlib import TestCase, unittest_main
 
 from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.utils import (make_uid, UStringIO, RepeatList, HTMLHead,
@@ -312,8 +313,12 @@
         finally:
             self.config.global_set_option('concat-resources', True)
 
-class DocTest(DocTest):
-    from cubicweb import utils as module
+
+def load_tests(loader, tests, ignore):
+    import cubicweb.utils
+    tests.addTests(doctest.DocTestSuite(cubicweb.utils))
+    return tests
+
 
 if __name__ == '__main__':
     unittest_main()