[Python-modules-commits] [logilab-common] 01/06: Import logilab-common_1.3.0.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Mon Dec 12 00:25:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository logilab-common.

commit 98ae7c4a9600a2c43e33772e3006867ed2718730
Author: Sandro Tosi <morph at debian.org>
Date:   Sun Dec 11 18:50:54 2016 -0500

    Import logilab-common_1.3.0.orig.tar.gz
---
 ChangeLog                              |  5 ++++
 MANIFEST.in                            |  6 ++---
 PKG-INFO                               |  3 +--
 README                                 |  1 -
 __pkginfo__.py                         |  4 ++--
 bin/{pytest => logilab-pytest}         |  0
 bin/{pytest.bat => logilab-pytest.bat} |  0
 doc/{pytest.1 => logilab-pytest.1}     | 20 ++++++++--------
 logilab/common/configuration.py        |  3 +++
 logilab/common/fileutils.py            |  8 +------
 logilab/common/modutils.py             | 40 +++++++++++++++++++++++--------
 logilab/common/pytest.py               | 34 +++++++++++++-------------
 logilab/common/shellutils.py           |  2 +-
 logilab/common/testlib.py              |  8 +++++--
 logilab_common.egg-info/PKG-INFO       |  3 +--
 logilab_common.egg-info/SOURCES.txt    |  6 ++---
 test/data/__pkginfo__.py               |  2 +-
 test/unittest_configuration.py         | 44 ++++++++++++++++++++++++++++++++++
 test/unittest_fileutils.py             | 13 ++++------
 test/unittest_modutils.py              | 16 +++++++------
 test/unittest_textutils.py             | 14 +++++------
 21 files changed, 150 insertions(+), 82 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8c87d34..95c96f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 ChangeLog for logilab.common
 ============================
 
+2016-10-03  -- 1.3.0
+
+    * pytest: executable deprecated and renamed as logilab-pytest to prevent
+    conflict with pytest provided by http://pytest.org/
+
 2016-03-15  -- 1.2.0
 
     * pytest: TraceController class, pause_tracing and resume_tracing
diff --git a/MANIFEST.in b/MANIFEST.in
index 64774b4..faee190 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,13 +2,13 @@ include ChangeLog
 include README*
 include COPYING
 include COPYING.LESSER
-include bin/pytest
-include bin/pytest.bat
+include bin/logilab-pytest
+include bin/logilab-pytest.bat
 include test/data/ChangeLog
 recursive-include test *.py *.txt *.msg *.ini *.zip *.egg
 recursive-include test/data/*_dir *
 recursive-include test/input *.py
 recursive-include doc/html *
-include doc/pytest.1
+include doc/logilab-pytest.1
 include doc/makefile
 include __pkginfo__.py
diff --git a/PKG-INFO b/PKG-INFO
index cda2328..33c5f6e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: logilab-common
-Version: 1.2.2
+Version: 1.3.0
 Summary: collection of low-level Python packages and modules used by Logilab projects
 Home-page: http://www.logilab.org/project/logilab-common
 Author: Logilab
@@ -133,7 +133,6 @@ Description: Logilab's common library
         versions:
         
         * `testlib`: use `unittest2`_ instead
-        * `pytest`: use `discover`_ instead
         * `interface`: use `zope.interface`_ if you really want this
         * `table`, `xmlutils`: is that used?
         * `sphinxutils`: we won't go that way imo (i == syt)
diff --git a/README b/README
index 6587ae2..21cbe78 100644
--- a/README
+++ b/README
@@ -125,7 +125,6 @@ Those `logilab.common` modules will much probably be deprecated in future
 versions:
 
 * `testlib`: use `unittest2`_ instead
-* `pytest`: use `discover`_ instead
 * `interface`: use `zope.interface`_ if you really want this
 * `table`, `xmlutils`: is that used?
 * `sphinxutils`: we won't go that way imo (i == syt)
diff --git a/__pkginfo__.py b/__pkginfo__.py
index bd1dfcc..e5c2e0d 100644
--- a/__pkginfo__.py
+++ b/__pkginfo__.py
@@ -25,7 +25,7 @@ modname = 'common'
 subpackage_of = 'logilab'
 subpackage_master = True
 
-numversion = (1, 2, 2)
+numversion = (1, 3, 0)
 version = '.'.join([str(num) for num in numversion])
 
 license = 'LGPL' # 2.1 or later
@@ -37,7 +37,7 @@ author_email = "contact at logilab.fr"
 
 
 from os.path import join
-scripts = [join('bin', 'pytest')]
+scripts = [join('bin', 'logilab-pytest')]
 include_dirs = [join('test', 'data')]
 
 install_requires = [
diff --git a/bin/pytest b/bin/logilab-pytest
similarity index 100%
rename from bin/pytest
rename to bin/logilab-pytest
diff --git a/bin/pytest.bat b/bin/logilab-pytest.bat
similarity index 100%
rename from bin/pytest.bat
rename to bin/logilab-pytest.bat
diff --git a/doc/pytest.1 b/doc/logilab-pytest.1
similarity index 62%
rename from doc/pytest.1
rename to doc/logilab-pytest.1
index bb6a1ce..51aec2e 100644
--- a/doc/pytest.1
+++ b/doc/logilab-pytest.1
@@ -1,21 +1,21 @@
-.TH pytest "1" "January 2008" pytest
+.TH logilab-pytest "1" "January 2008" logilab-pytest
 .SH NAME
-.B pytest 
+.B logilab-pytest
 \- run python unit tests
 
 .SH SYNOPSIS
-usage: pytest [OPTIONS] [testfile [testpattern]]
+usage: logilab-pytest [OPTIONS] [testfile [testpattern]]
 .PP
 examples:
 .PP
-pytest path/to/mytests.py
-pytest path/to/mytests.py TheseTests
-pytest path/to/mytests.py TheseTests.test_thisone
+logilab-pytest path/to/mytests.py
+logilab-pytest path/to/mytests.py TheseTests
+logilab-pytest path/to/mytests.py TheseTests.test_thisone
 .PP
-pytest one (will run both test_thisone and test_thatone)
-pytest path/to/mytests.py \fB\-s\fR not (will skip test_notthisone)
+logilab-pytest one (will run both test_thisone and test_thatone)
+logilab-pytest path/to/mytests.py \fB\-s\fR not (will skip test_notthisone)
 .PP
-pytest \fB\-\-coverage\fR test_foo.py
+logilab-pytest \fB\-\-coverage\fR test_foo.py
 .IP
 (only if logilab.devtools is available)
 .SS "options:"
@@ -37,7 +37,7 @@ Enable test failure inspection (conflicts with
 \fB\-\-coverage\fR)
 .TP
 \fB\-x\fR, \fB\-\-exitfirst\fR
-Exit on first failure (only make sense when pytest run
+Exit on first failure (only make sense when logilab-pytest run
 one test file)
 .TP
 \fB\-s\fR SKIPPED, \fB\-\-skip\fR=\fISKIPPED\fR
diff --git a/logilab/common/configuration.py b/logilab/common/configuration.py
index bdea905..52ac6df 100644
--- a/logilab/common/configuration.py
+++ b/logilab/common/configuration.py
@@ -401,6 +401,9 @@ def ini_format(stream, options, encoding):
             print('#%s=' % optname, file=stream)
         else:
             value = _encode(value, encoding).strip()
+            if optdict.get('type') == 'string' and '\n' in value:
+                prefix = '\n    '
+                value = prefix + prefix.join(value.split('\n'))
             print('%s=%s' % (optname, value), file=stream)
 
 format_section = ini_format_section
diff --git a/logilab/common/fileutils.py b/logilab/common/fileutils.py
index b30cf5f..366d23d 100644
--- a/logilab/common/fileutils.py
+++ b/logilab/common/fileutils.py
@@ -67,13 +67,7 @@ def first_level_directory(path):
     return head
 
 def abspath_listdir(path):
-    """Lists path's content using absolute paths.
-
-    >>> os.listdir('/home')
-    ['adim', 'alf', 'arthur', 'auc']
-    >>> abspath_listdir('/home')
-    ['/home/adim', '/home/alf', '/home/arthur', '/home/auc']
-    """
+    """Lists path's content using absolute paths."""
     path = abspath(path)
     return [join(path, filename) for filename in listdir(path)]
 
diff --git a/logilab/common/modutils.py b/logilab/common/modutils.py
index e70a1a9..f8e91ad 100644
--- a/logilab/common/modutils.py
+++ b/logilab/common/modutils.py
@@ -32,12 +32,14 @@ __docformat__ = "restructuredtext en"
 
 import sys
 import os
-from os.path import splitext, join, abspath, isdir, dirname, exists, basename
+from os.path import (splitext, join, abspath, isdir, dirname, exists,
+                     basename, expanduser, normcase, realpath)
 from imp import find_module, load_module, C_BUILTIN, PY_COMPILED, PKG_DIRECTORY
 from distutils.sysconfig import get_config_var, get_python_lib, get_python_version
 from distutils.errors import DistutilsPlatformError
 
-from six.moves import range
+from six import PY3
+from six.moves import map, range
 
 try:
     import zipimport
@@ -219,6 +221,19 @@ def _check_init(path, mod_path):
     return True
 
 
+def _canonicalize_path(path):
+    return realpath(expanduser(path))
+
+
+def _path_from_filename(filename):
+    if PY3:
+        return filename
+    else:
+        if filename.endswith(".pyc"):
+            return filename[:-1]
+        return filename
+
+
 def modpath_from_file(filename, extrapath=None):
     """given a file path return the corresponding splitted module's name
     (i.e name of a module or package splitted on '.')
@@ -239,26 +254,29 @@ def modpath_from_file(filename, extrapath=None):
     :rtype: list(str)
     :return: the corresponding splitted module's name
     """
-    base = splitext(abspath(filename))[0]
+    filename = _path_from_filename(filename)
+    filename = _canonicalize_path(filename)
+    base = os.path.splitext(filename)[0]
+
     if extrapath is not None:
-        for path_ in extrapath:
+        for path_ in map(_canonicalize_path, extrapath):
             path = abspath(path_)
-            if path and base[:len(path)] == path:
+            if path and normcase(base[:len(path)]) == normcase(path):
                 submodpath = [pkg for pkg in base[len(path):].split(os.sep)
                               if pkg]
                 if _check_init(path, submodpath[:-1]):
                     return extrapath[path_].split('.') + submodpath
-    for path in sys.path:
-        path = abspath(path)
-        if path and base.startswith(path):
+
+    for path in map(_canonicalize_path, sys.path):
+        if path and normcase(base).startswith(path):
             modpath = [pkg for pkg in base[len(path):].split(os.sep) if pkg]
             if _check_init(path, modpath[:-1]):
                 return modpath
+
     raise ImportError('Unable to find module for %s in %s' % (
         filename, ', \n'.join(sys.path)))
 
 
-
 def file_from_modpath(modpath, path=None, context_file=None):
     """given a mod path (i.e. splitted module / package name), return the
     corresponding file, giving priority to source file over precompiled
@@ -636,7 +654,9 @@ def _module_file(modpath, path=None):
         # setuptools has added into sys.modules a module object with proper
         # __path__, get back information from there
         module = sys.modules[modpath.pop(0)]
-        path = module.__path__
+        # use list() to protect against _NamespacePath instance we get with python 3, which
+        # find_module later doesn't like
+        path = list(module.__path__)
         if not modpath:
             return C_BUILTIN, None
     imported = []
diff --git a/logilab/common/pytest.py b/logilab/common/pytest.py
index f5fb8ff..c644a61 100644
--- a/logilab/common/pytest.py
+++ b/logilab/common/pytest.py
@@ -15,14 +15,14 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with logilab-common.  If not, see <http://www.gnu.org/licenses/>.
-"""pytest is a tool that eases test running and debugging.
+"""logilab-pytest is a tool that eases test running and debugging.
 
-To be able to use pytest, you should either write tests using
+To be able to use logilab-pytest, you should either write tests using
 the logilab.common.testlib's framework or the unittest module of the
 Python's standard library.
 
-You can customize pytest's behaviour by defining a ``pytestconf.py`` file
-somewhere in your test directory. In this file, you can add options or
+You can customize logilab-pytest's behaviour by defining a ``pytestconf.py``
+file somewhere in your test directory. In this file, you can add options or
 change the way tests are run.
 
 To add command line options, you must define a ``update_parser`` function in
@@ -31,8 +31,8 @@ that will be the OptionParser's instance to customize.
 
 If you wish to customize the tester, you'll have to define a class named
 ``CustomPyTester``. This class should extend the default `PyTester` class
-defined in the pytest module. Take a look at the `PyTester` and `DjangoTester`
-classes for more information about what can be done.
+defined in the logilab.common.pytest module. Take a look at the `PyTester` and
+`DjangoTester` classes for more information about what can be done.
 
 For instance, if you wish to add a custom -l option to specify a loglevel, you
 could define the following ``pytestconf.py`` file ::
@@ -101,13 +101,13 @@ PYTEST_DOC = """%prog [OPTIONS] [testfile [testpattern]]
 
 examples:
 
-pytest path/to/mytests.py
-pytest path/to/mytests.py TheseTests
-pytest path/to/mytests.py TheseTests.test_thisone
-pytest path/to/mytests.py -m '(not long and database) or regr'
+logilab-pytest path/to/mytests.py
+logilab-pytest path/to/mytests.py TheseTests
+logilab-pytest path/to/mytests.py TheseTests.test_thisone
+logilab-pytest path/to/mytests.py -m '(not long and database) or regr'
 
-pytest one (will run both test_thisone and test_thatone)
-pytest path/to/mytests.py -s not (will skip test_notthisone)
+logilab-pytest one (will run both test_thisone and test_thatone)
+logilab-pytest path/to/mytests.py -s not (will skip test_notthisone)
 """
 
 ENABLE_DBC = False
@@ -124,6 +124,7 @@ from inspect import isgeneratorfunction, isclass
 from random import shuffle
 from itertools import dropwhile
 
+from logilab.common.deprecation import deprecated
 from logilab.common.fileutils import abspath_listdir
 from logilab.common import textutils
 from logilab.common import testlib, STD_BLACKLIST
@@ -558,12 +559,12 @@ def make_parser():
         warnings.simplefilter('ignore', DeprecationWarning)
         rebuild_cmdline(option, opt, value, parser)
 
-    # pytest options
+    # logilab-pytest options
     parser.add_option('-t', dest='testdir', default=None,
                       help="directory where the tests will be found")
     parser.add_option('-d', dest='dbc', default=False,
                       action="store_true", help="enable design-by-contract")
-    # unittest_main options provided and passed through pytest
+    # unittest_main options provided and passed through logilab-pytest
     parser.add_option('-v', '--verbose', callback=rebuild_cmdline,
                       action="callback", help="Verbose output")
     parser.add_option('-i', '--pdb', callback=rebuild_and_store,
@@ -572,7 +573,7 @@ def make_parser():
     parser.add_option('-x', '--exitfirst', callback=rebuild_and_store,
                       dest="exitfirst", default=False,
                       action="callback", help="Exit on first failure "
-                      "(only make sense when pytest run one test file)")
+                      "(only make sense when logilab-pytest run one test file)")
     parser.add_option('-R', '--restart', callback=rebuild_and_store,
                       dest="restart", default=False,
                       action="callback",
@@ -598,7 +599,7 @@ def make_parser():
     if DJANGO_FOUND:
         parser.add_option('-J', '--django', dest='django', default=False,
                           action="store_true",
-                          help='use pytest for django test cases')
+                          help='use logilab-pytest for django test cases')
     return parser
 
 
@@ -631,6 +632,7 @@ def parseargs(parser):
 
 
 
+ at deprecated('[logilab-common 1.3] logilab-pytest is deprecated, use another test runner')
 def run():
     parser = make_parser()
     rootdir, testercls = project_root(parser)
diff --git a/logilab/common/shellutils.py b/logilab/common/shellutils.py
index b4abbf1..b9d5fa6 100644
--- a/logilab/common/shellutils.py
+++ b/logilab/common/shellutils.py
@@ -304,7 +304,7 @@ class ProgressBar(object):
 
 
 class DummyProgressBar(object):
-    __slot__ = ('text',)
+    __slots__ = ('text',)
 
     def refresh(self):
         pass
diff --git a/logilab/common/testlib.py b/logilab/common/testlib.py
index 0114713..fa3e36e 100644
--- a/logilab/common/testlib.py
+++ b/logilab/common/testlib.py
@@ -56,10 +56,10 @@ from shutil import rmtree
 from operator import itemgetter
 from inspect import isgeneratorfunction
 
-from six import string_types
+from six import PY2, add_metaclass, string_types
 from six.moves import builtins, range, configparser, input
 
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import class_deprecated, deprecated
 
 import unittest as unittest_legacy
 if not getattr(unittest_legacy, "__package__", None):
@@ -90,6 +90,8 @@ is_generator = deprecated('[lgc 0.63] use inspect.isgeneratorfunction')(isgenera
 __unittest = 1
 
 
+ at deprecated('with_tempdir is deprecated, use {0}.TemporaryDirectory.'.format(
+    'tempfile' if not PY2 else 'backports.tempfile'))
 def with_tempdir(callable):
     """A decorator ensuring no temporary file left when the function return
     Work only for temporary file created with the tempfile module"""
@@ -548,11 +550,13 @@ class DocTestFinder(doctest.DocTestFinder):
                                                globs, source_lines)
 
 
+ at add_metaclass(class_deprecated)
 class DocTest(TestCase):
     """trigger module doctest
     I don't know how to make unittest.main consider the DocTestSuite instance
     without this hack
     """
+    __deprecation_warning__ = 'use stdlib doctest module with unittest API directly'
     skipped = ()
     def __call__(self, result=None, runcondition=None, options=None):\
         # pylint: disable=W0613
diff --git a/logilab_common.egg-info/PKG-INFO b/logilab_common.egg-info/PKG-INFO
index cda2328..33c5f6e 100644
--- a/logilab_common.egg-info/PKG-INFO
+++ b/logilab_common.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: logilab-common
-Version: 1.2.2
+Version: 1.3.0
 Summary: collection of low-level Python packages and modules used by Logilab projects
 Home-page: http://www.logilab.org/project/logilab-common
 Author: Logilab
@@ -133,7 +133,6 @@ Description: Logilab's common library
         versions:
         
         * `testlib`: use `unittest2`_ instead
-        * `pytest`: use `discover`_ instead
         * `interface`: use `zope.interface`_ if you really want this
         * `table`, `xmlutils`: is that used?
         * `sphinxutils`: we won't go that way imo (i == syt)
diff --git a/logilab_common.egg-info/SOURCES.txt b/logilab_common.egg-info/SOURCES.txt
index 8e466a8..4aee41c 100644
--- a/logilab_common.egg-info/SOURCES.txt
+++ b/logilab_common.egg-info/SOURCES.txt
@@ -6,10 +6,10 @@ README
 __pkginfo__.py
 setup.cfg
 setup.py
-bin/pytest
-bin/pytest.bat
+bin/logilab-pytest
+bin/logilab-pytest.bat
+doc/logilab-pytest.1
 doc/makefile
-doc/pytest.1
 logilab/__init__.py
 logilab/common/__init__.py
 logilab/common/cache.py
diff --git a/test/data/__pkginfo__.py b/test/data/__pkginfo__.py
index 7ebce74..39df3b6 100644
--- a/test/data/__pkginfo__.py
+++ b/test/data/__pkginfo__.py
@@ -37,7 +37,7 @@ author_email = "contact at logilab.fr"
 
 
 from os.path import join
-scripts = [join('bin', 'pytest')]
+scripts = [join('bin', 'logilab-pytest')]
 include_dirs = [join('test', 'data')]
 
 install_requires = [
diff --git a/test/unittest_configuration.py b/test/unittest_configuration.py
index 2a32653..f59a0e0 100644
--- a/test/unittest_configuration.py
+++ b/test/unittest_configuration.py
@@ -271,6 +271,50 @@ diffgroup=pouet
 
 #opt-b-2=""")
 
+    def test_generate_config_with_multiline_string(self):
+        self.cfg['value'] = 'line1\nline2\nline3'
+        stream = StringIO()
+        self.cfg.generate_config(stream)
+        self.assertMultiLineEqual(stream.getvalue().strip(), """[TEST]
+
+dothis=yes
+
+value=
+    line1
+    line2
+    line3
+
+# you can also document the option
+multiple=yop,yep
+
+# boom
+number=2
+
+bytes=1KB
+
+choice=yo
+
+multiple-choice=yo,ye
+
+named=key:val
+
+reset-value=
+    line1
+    line2
+    line3
+
+
+[AGROUP]
+
+diffgroup=pouet
+
+
+[BGROUP]
+
+#opt-b-1=
+
+#opt-b-2=""")
+
 
     def test_roundtrip(self):
         cfg = self.cfg
diff --git a/test/unittest_fileutils.py b/test/unittest_fileutils.py
index 927347d..80cefe4 100644
--- a/test/unittest_fileutils.py
+++ b/test/unittest_fileutils.py
@@ -17,6 +17,7 @@
 # with logilab-common.  If not, see <http://www.gnu.org/licenses/>.
 """unit tests for logilab.common.fileutils"""
 
+import doctest
 import sys, os, tempfile, shutil
 from stat import S_IWRITE
 from os.path import join
@@ -132,16 +133,12 @@ class ProtectedFileTC(TestCase):
         self.assertTrue(not os.stat(self.rpath).st_mode & S_IWRITE)
 
 
-from logilab.common.testlib import DocTest
 if sys.version_info < (3, 0):
-    # skip if python3, test fail because of traceback display incompatibility :(
-    class ModuleDocTest(DocTest):
-        """relative_path embed tests in docstring"""
-        from logilab.common import fileutils as module
-        skipped = ('abspath_listdir',)
+    def load_tests(loader, tests, ignore):
+        from logilab.common import fileutils
+        tests.addTests(doctest.DocTestSuite(fileutils))
+        return tests
 
 
-del DocTest # necessary if we don't want it to be executed (we don't...)
-
 if __name__ == '__main__':
     unittest_main()
diff --git a/test/unittest_modutils.py b/test/unittest_modutils.py
index dfed2ff..d1fcaf9 100644
--- a/test/unittest_modutils.py
+++ b/test/unittest_modutils.py
@@ -19,6 +19,7 @@
 unit tests for module modutils (module manipulation utilities)
 """
 
+import doctest
 import sys
 try:
     __file__
@@ -144,8 +145,9 @@ class file_from_modpath_tc(ModutilsTestCase):
     if it exists"""
 
     def test_site_packages(self):
-        self.assertEqual(path.realpath(modutils.file_from_modpath(['logilab', 'common', 'modutils'])),
-                         path.realpath(modutils.__file__.replace('.pyc', '.py')))
+        from pytz import tzinfo
+        self.assertEqual(path.realpath(modutils.file_from_modpath(['pytz', 'tzinfo'])),
+                         path.realpath(tzinfo.__file__.replace('.pyc', '.py')))
 
     def test_std_lib(self):
         from os import path
@@ -279,11 +281,11 @@ class get_modules_files_tc(ModutilsTestCase):
         self.assertTrue( hasattr(logilab.common, 'fileutils') )
         self.assertTrue( m is logilab.common.fileutils )
 
-from logilab.common.testlib import DocTest
-class ModuleDocTest(DocTest):
-    """test doc test in this module"""
-    from logilab.common import modutils as module
-del DocTest # necessary if we don't want it to be executed (we don't...)
+
+def load_tests(loader, tests, ignore):
+    from logilab.common import modutils
+    tests.addTests(doctest.DocTestSuite(modutils))
+    return tests
 
 
 if __name__ == '__main__':
diff --git a/test/unittest_textutils.py b/test/unittest_textutils.py
index db18d0d..8deb4ee 100644
--- a/test/unittest_textutils.py
+++ b/test/unittest_textutils.py
@@ -21,11 +21,12 @@ unit tests for module textutils
 squeleton generated by /home/syt/cvs_work/logilab/pyreverse/py2tests.py on Sep 08 at 09:1:31
 
 """
+import doctest
 import re
 from os import linesep
 
-from logilab.common import textutils as tu # .textutils import *
-from logilab.common.testlib import TestCase, DocTest, unittest_main
+from logilab.common import textutils as tu
+from logilab.common.testlib import TestCase, unittest_main
 
 
 if linesep != '\n':
@@ -256,11 +257,10 @@ class UnormalizeTC(TestCase):
         self.assertEqual(tu.unormalize(u"\u8000", substitute=''), u'')
 
 
-class ModuleDocTest(DocTest):
-    """test doc test in this module"""
-    module = tu
-    # from logilab.common import textutils as module
-del DocTest # necessary if we don't want it to be executed (we don't...)
+def load_tests(loader, tests, ignore):
+    tests.addTests(doctest.DocTestSuite(tu))
+    return tests
+
 
 if __name__ == '__main__':
     unittest_main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/logilab-common.git



More information about the Python-modules-commits mailing list