Beispiel #1
0
def _genAll(verbose=1):
    from reportlab.lib.testutils import setOutDir
    setOutDir(__name__)
    from reportlab.lib.testutils import testsFolder
    topDir=os.path.dirname(testsFolder)
    L = [os.path.join(topDir,f) for f in (
            'docs/reference/genreference.py',
            'docs/userguide/genuserguide.py',
            'src/tools/docco/graphdocpy.py',
            )   
        ]
    for f in ('src/rl_addons/pyRXP/docs/PyRXP_Documentation.rml',
            ):
        f = os.path.join(topDir,f)
        if os.path.isfile(f):
            L += [f]
            break
    for p in L:
        os.chdir(os.path.dirname(p))
        if p[-4:]=='.rml':
            try:
                from rlextra.rml2pdf.rml2pdf import main
                main(exe=0,fn=[os.path.basename(p)], quiet=not verbose, outDir=d)
            except:
                if verbose: traceback.print_exc()
        else:
            cmd = '"%s" %s %s' % (sys.executable,os.path.basename(p), not verbose and '-s' or '')
            if verbose: print(cmd)
            os.system(cmd)
Beispiel #2
0
    except ImportError:
        if __name__=='__main__':
            topDir = os.path.dirname(sys.argv[0])
            if not topDir: topDir = os.getcwd()
        else:
            topDir = os.path.dirname(__file__)
        topDir = os.path.dirname(os.path.abspath(topDir))
        if not os.path.isdir(os.path.join(topDir,'reportlab')):
            topDir=os.path.join(topDir,'src')
            assert os.path.isdir(os.path.join(topDir,'reportlab')), "Cannot find reportlab"
        sys.path.insert(0, topDir)
        P.append(topDir)
        del topDir
        from reportlab.lib.testutils import setOutDir

    setOutDir(__name__)
    from reportlab.lib.testutils import testsFolder as topDir
    if topDir:
        topDir = os.path.dirname(topDir)
        if topDir not in sys.path:
            sys.path.insert(0,topDir)
            P.append(topDir)
    del topDir
    from reportlab.lib.testutils import GlobDirectoryWalker, outputfile, printLocation
    pp = os.environ.get('PYTHONPATH','')
    if pp: P.append(pp)
    del pp
    os.environ['PYTHONPATH']=os.pathsep.join(P)
    del P

def makeSuite(folder, exclude=[],nonImportable=[],pattern='test_*.py'):
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
__version__=''' $Id: test_platypus_general.py 3660 2010-02-08 18:17:33Z damian $ '''

#tests and documents Page Layout API
__doc__="""This is not obvious so here's a brief explanation.  This module is both
the test script and user guide for layout.  Each page has two frames on it:
one for commentary, and one for demonstration objects which may be drawn in
various esoteric ways.  The two functions getCommentary() and getExamples()
return the 'story' for each.  The run() function gets the stories, then
builds a special "document model" in which the frames are added to each page
and drawn into.
"""
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
import string, copy, sys, os
from reportlab.pdfgen import canvas
from reportlab import platypus
from reportlab.platypus import BaseDocTemplate, PageTemplate, Flowable, FrameBreak
from reportlab.platypus import Paragraph, Preformatted
from reportlab.lib.units import inch, cm
from reportlab.lib.styles import PropertySet, getSampleStyleSheet, ParagraphStyle
from reportlab.lib import colors
from reportlab.rl_config import defaultPageSize
from reportlab.lib.utils import haveImages, _RL_DIR, rl_isfile, open_for_read, fileName2Utf8
import unittest
from reportlab.lib.testutils import testsFolder
if haveImages:
    _GIF = os.path.join(testsFolder,'pythonpowered.gif')
    if not rl_isfile(_GIF): _GIF = None
else: