tests/test_docstrings.py
author robin <robin@reportlab.com>
Tue, 07 Mar 2017 10:00:34 +0000
changeset 4330 617ffa6bbdc8
parent 4252 fe660f227cac
child 4585 adf8e6efb0c6
permissions -rw-r--r--
changes for release 3.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     1
#!/usr/bin/env python
4330
617ffa6bbdc8 changes for release 3.4.0
robin <robin@reportlab.com>
parents: 4252
diff changeset
     2
#Copyright ReportLab Europe Ltd. 2000-2017
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     3
#see license.txt for license details
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     4
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     5
"""This is a test on a package level that find all modules,
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     6
classes, methods and functions that do not have a doc string
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     7
and lists them in individual log files.
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     8
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     9
Currently, methods with leading and trailing double underscores
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    10
are skipped.
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    11
"""
3075
5175c093a0dd tests: fix RL_HOME reference problems
rgbecker
parents: 2984
diff changeset
    12
from reportlab.lib.testutils import setOutDir,SecureTestCase, GlobDirectoryWalker, outputfile, printLocation
2984
c63f149d55aa tests.utils --> reportlab.lib.testutils
rgbecker
parents: 2966
diff changeset
    13
setOutDir(__name__)
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    14
import os, sys, glob, re, unittest, inspect
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    15
import reportlab
4239
75c7de3058a6 more changes related to pypy testing
robin
parents: 4017
diff changeset
    16
from reportlab.lib.utils import rl_exec, isPy3, isPyPy
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    17
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    18
def typ2is(typ):
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    19
    return getattr(inspect,'is'+typ)
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    20
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    21
_typ2key={
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    22
        'module':lambda x: (x[0],getattr(x[1],'__name__',''),getattr(x[1],'__path__',getattr(x,'__file__',''))),
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    23
        'class':lambda x: (x[0],getattr(x[1],'__name__',''),getattr(x[1],'__module__','')),
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    24
        'method':lambda x: (x[0],getattr(x[1],'__name__',''),getattr(x[1],'__module__','')),
4239
75c7de3058a6 more changes related to pypy testing
robin
parents: 4017
diff changeset
    25
        'function':lambda x: (x[0],getattr(x[1],'__name__',''),'???' if isPyPy else x[1].__code__.co_filename),
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    26
        }
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    27
def typ2key(typ):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    28
    return _typ2key[typ]
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    29
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    30
def obj2typ(obj):
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    31
    for typ in ('function','module','class','method'):
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    32
        if typ2is(typ)(obj): return typ
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    33
    return None
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
    34
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    35
3910
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    36
def getClass(obj):
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    37
    try:
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    38
        return obj.__self__.__class__
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    39
    except:
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    40
        try:
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    41
            return obj.im_class
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    42
        except:
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    43
            return None
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    44
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    45
from pkgutil import iter_modules
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    46
def walk_packages_ex(path=None, prefix='', onerror=None, cond=None):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    47
    def seen(p, m={}):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    48
        if p in m:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    49
            return True
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    50
        m[p] = True
3910
9f97541a63fe test_docstrings.py: quieten for python2, but functions, methods & classes are broken
robin
parents: 3804
diff changeset
    51
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    52
    for importer, name, ispkg in iter_modules(path, prefix):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    53
        if cond and not cond(importer,name,ispkg): continue
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    54
        yield importer, name, ispkg
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    55
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    56
        if ispkg:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    57
            try:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    58
                __import__(name)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    59
            except ImportError:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    60
                if onerror is not None:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    61
                    onerror(name)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    62
            except Exception:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    63
                if onerror is not None:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    64
                    onerror(name)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    65
                else:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    66
                    raise
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    67
            else:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    68
                path = getattr(sys.modules[name], '__path__', None) or []
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    69
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    70
                # don't traverse path items we've seen before
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    71
                path = [p for p in path if not seen(p)]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    72
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    73
                for item in walk_packages_ex(path, name+'.', onerror, cond):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    74
                    yield item
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    75
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    76
def rl_module(i,name,pkg):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    77
    return name=='reportlab' or name.startswith('reportlab.')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    78
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    79
rl_modules = None
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    80
def getRLModules():
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    81
    "Get a list of all objects defined *somewhere* in a package."
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    82
    global rl_modules
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    83
    if rl_modules is None:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    84
        rl_modules = []
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    85
        for _,name,_ in walk_packages_ex(cond=rl_module):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    86
            rl_modules.append(name)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    87
    return rl_modules
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    88
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    89
def getObjects(objects,lookup,mName,modBn,tobj):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    90
    ttyp = obj2typ(tobj)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    91
    for n in dir(tobj):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    92
        obj = getattr(tobj,n,None)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    93
        try:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    94
            if obj in lookup: continue
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    95
        except:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    96
            continue
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    97
        typ = obj2typ(obj)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
    98
        if typ in ('function','method'):
4239
75c7de3058a6 more changes related to pypy testing
robin
parents: 4017
diff changeset
    99
            if not isPyPy and os.path.splitext(obj.__code__.co_filename)[0]==modBn:
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   100
                lookup[obj] = 1
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   101
                objects.setdefault(typ if typ=='function' and ttyp=='module' else 'method',[]).append((mName,obj))
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   102
        elif typ=='class':
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   103
            if obj.__module__==mName:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   104
                lookup[obj] = 1
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   105
                objects.setdefault(typ,[]).append((mName,obj))
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   106
                getObjects(objects,lookup,mName,modBn,obj)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   107
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   108
def getModuleObjects(modules):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   109
    objects = {}
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   110
    lookup = {}
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   111
    for mName in modules:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   112
        try:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   113
            NS = {}
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   114
            rl_exec("import %s as module" % mName,NS)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   115
        except ImportError:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   116
            continue
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   117
        else:
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   118
            module = NS['module']
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   119
        if module in lookup: continue
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   120
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   121
        lookup[module] = 1
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   122
        objects.setdefault('module',[]).append((mName, module))
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   123
        modBn = os.path.splitext(module.__file__)[0]
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   124
        getObjects(objects,lookup,mName,modBn,module)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   125
    return objects
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   126
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   127
class DocstringTestCase(SecureTestCase):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   128
    "Testing if objects in the ReportLab package have docstrings."
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   129
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   130
    def setUp(self):
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   131
        SecureTestCase.setUp(self)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   132
        self.modules = getRLModules()
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   133
        self.objects = getModuleObjects(self.modules)
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   134
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   135
    def _writeLogFile(self, typ):
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   136
        "Write log file for different kind of documentable objects."
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   137
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   138
        objects = self.objects.get(typ,[])
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   139
        objects.sort(key=typ2key(typ))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   140
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
   141
        expl = {'function':'functions',
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
   142
                'class':'classes',
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
   143
                'method':'methods',
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   144
                'module':'modules'}[typ]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   145
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   146
        path = outputfile("test_docstrings-%s.log" % expl)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   147
        file = open(path, 'w')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   148
        file.write('No doc strings found for the following %s below.\n\n' % expl)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   149
        p = re.compile('__.+__')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   150
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   151
        lines = []
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   152
        for name, obj in objects:
3915
5efe42fa0252 test_docstrings.py: now somewhat working
robin
parents: 3910
diff changeset
   153
            if typ == 'method':
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   154
                n = obj.__name__
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   155
                # Skip names with leading and trailing double underscores.
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   156
                if p.match(n):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   157
                    continue
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   158
3917
1df8063a2483 test_docstrings.py: make it a bit cleaner
robin
parents: 3915
diff changeset
   159
            if not obj.__doc__ or len(obj.__doc__) == 0:
1df8063a2483 test_docstrings.py: make it a bit cleaner
robin
parents: 3915
diff changeset
   160
                if typ == 'function':
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   161
                    lines.append("%s.%s\n" % (name, obj.__name__))
3917
1df8063a2483 test_docstrings.py: make it a bit cleaner
robin
parents: 3915
diff changeset
   162
                elif typ == 'class':
4017
8248cb6111c2 test_docstrings.py: fix __qualname__ access
robin
parents: 3917
diff changeset
   163
                    lines.append("%s.%s\n" % (obj.__module__, getattr(obj,'__qualname__',getattr(obj,'__name__','[unknown __name__]'))))
3917
1df8063a2483 test_docstrings.py: make it a bit cleaner
robin
parents: 3915
diff changeset
   164
                else:
4017
8248cb6111c2 test_docstrings.py: fix __qualname__ access
robin
parents: 3917
diff changeset
   165
                    lines.append("%s\n" % (getattr(obj,'__qualname__',getattr(obj,'__name__','[unknown __name__]'))))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   166
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   167
        lines.sort()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   168
        for line in lines:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   169
            file.write(line)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   170
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   171
        file.close()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   172
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   173
    def test0(self):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   174
        "Test if functions have a doc string."
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
   175
        self._writeLogFile('function')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   176
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   177
    def test1(self):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   178
        "Test if classes have a doc string."
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
   179
        self._writeLogFile('class')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   180
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   181
    def test2(self):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   182
        "Test if methods have a doc string."
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
   183
        self._writeLogFile('method')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   184
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   185
    def test3(self):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   186
        "Test if modules have a doc string."
3804
79c6b1df0eca fix test_docstrings.py
robin
parents: 3794
diff changeset
   187
        self._writeLogFile('module')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   188
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   189
def makeSuite():
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   190
    suite = unittest.TestSuite()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   191
    loader = unittest.TestLoader()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   192
    if sys.platform[:4] != 'java': suite.addTest(loader.loadTestsFromTestCase(DocstringTestCase))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   193
    return suite
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   194
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   195
#noruntests
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   196
if __name__ == "__main__":
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   197
    unittest.TextTestRunner().run(makeSuite())
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   198
    printLocation()