tests.utils --> reportlab.lib.testutils
authorrgbecker
Mon, 15 Sep 2008 11:03:17 +0000
changeset 2984 c63f149d55aa
parent 2983 0b2e5d0a95ab
child 2985 c37ef9442fa4
tests.utils --> reportlab.lib.testutils
tests/runAll.py
tests/test_charts_textlabels.py
tests/test_docs_build.py
tests/test_docstrings.py
tests/test_extra.py
tests/test_graphics_charts.py
tests/test_graphics_images.py
tests/test_graphics_layout.py
tests/test_graphics_speed.py
tests/test_hello.py
tests/test_images.py
tests/test_invariant.py
tests/test_lib_colors.py
tests/test_lib_sequencer.py
tests/test_lib_utils.py
tests/test_lib_validators.py
tests/test_multibyte_chs.py
tests/test_multibyte_cht.py
tests/test_multibyte_jpn.py
tests/test_multibyte_kor.py
tests/test_paragraphs.py
tests/test_pdfbase_encodings.py
tests/test_pdfbase_fontembed.py
tests/test_pdfbase_pdfmetrics.py
tests/test_pdfbase_pdfutils.py
tests/test_pdfbase_postscript.py
tests/test_pdfbase_ttfonts.py
tests/test_pdfgen_callback.py
tests/test_pdfgen_general.py
tests/test_pdfgen_links.py
tests/test_pdfgen_pagemodes.py
tests/test_pdfgen_pycanvas.py
tests/test_platypus_breaking.py
tests/test_platypus_general.py
tests/test_platypus_indents.py
tests/test_platypus_leftright.py
tests/test_platypus_paragraphs.py
tests/test_platypus_paraparser.py
tests/test_platypus_pleaseturnover.py
tests/test_platypus_tables.py
tests/test_platypus_toc.py
tests/test_platypus_xref.py
tests/test_pyfiles.py
tests/test_renderSVG.py
tests/test_rl_accel.py
tests/test_source_chars.py
tests/test_table_layout.py
tests/test_tools_pythonpoint.py
tests/test_utils.py
tests/test_widgetbase_tpc.py
tests/test_widgets_grids.py
tests/utils.py
--- a/tests/runAll.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/runAll.py	Mon Sep 15 11:03:17 2008 +0000
@@ -10,13 +10,20 @@
 #run 'setup.py tests', but won't be if you CD into the tests
 #directory and run this directly
 try:
-    from tests.utils import GlobDirectoryWalker, outputfile, printLocation
+    from reportlab.lib.testutils import setOutDir,GlobDirectoryWalker, outputfile, printLocation
 except ImportError:
-    directoryAboveMe = os.path.dirname(os.getcwd())
-    sys.path.insert(0, directoryAboveMe)
-    from tests.utils import GlobDirectoryWalker, outputfile, printLocation
-    
-    
+    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))
+    sys.path.insert(0, topDir)
+    pp=os.environ.get('PYTHONPATH','')
+    pp = pp and os.sep.join(topDir,pp) or topDir
+    os.environ['PYTHONPATH'] = pp
+    from reportlab.lib.testutils import setOutDir,GlobDirectoryWalker, outputfile, printLocation
+setOutDir(__name__)
 
 def makeSuite(folder, exclude=[],nonImportable=[],pattern='test_*.py'):
     "Build a test suite of all available test files."
--- a/tests/test_charts_textlabels.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_charts_textlabels.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,12 +3,12 @@
 """
 Tests for the text Label class.
 """
+from reportlab.lib.testutils import setOutDir,setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 
 import os, sys, copy
 from os.path import join, basename, splitext
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.lib import colors
 from reportlab.lib.units import cm
 from reportlab.lib.pagesizes import A4
--- a/tests/test_docs_build.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_docs_build.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,8 +1,9 @@
 __version__=''' $Id$ '''
 """Tests that all manuals can be built.
 """
+from reportlab.lib.testutils import setOutDir,SecureTestCase, printLocation, testsFolder
+setOutDir(__name__)
 import os, sys, unittest
-from tests.utils import SecureTestCase, printLocation, testsFolder
 
 class ManualTestCase(SecureTestCase):
     "Runs all 3 manual-builders from the top."
--- a/tests/test_docstrings.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_docstrings.py	Mon Sep 15 11:03:17 2008 +0000
@@ -9,9 +9,10 @@
 Currently, methods with leading and trailing double underscores
 are skipped.
 """
+from reportlab.lib.testutils import setOutDir,SecureTestCase, GlobDirectoryWalker, outputfile, printLocation, RL_HOME
+setOutDir(__name__)
 import os, sys, glob, string, re, unittest
 from types import ModuleType, ClassType, MethodType, FunctionType
-from tests.utils import SecureTestCase, GlobDirectoryWalker, outputfile, printLocation, RL_HOME
 import reportlab
 
 def getModuleObjects(folder, rootName, typ, pattern='*.py'):
--- a/tests/test_extra.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_extra.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,8 +1,9 @@
 """This executes tests defined outside the normal test suite.
 See docstring for class ExternalTestCase for more information.
 """
+from reportlab.lib.testutils import setOutDir,SecureTestCase, printLocation, RL_HOME
+setOutDir(__name__)
 import os, string, fnmatch, re, sys, unittest
-from tests.utils import SecureTestCase, printLocation, RL_HOME
 EXTRA_FILE = 'extra.txt'
 
 class ExternalTestCase(SecureTestCase):
--- a/tests/test_graphics_charts.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_graphics_charts.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,12 +3,12 @@
 """
 Tests for chart class.
 """
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 
 import os, sys, copy
 from os.path import join, basename, splitext
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.lib import colors
 from reportlab.lib.units import cm
 from reportlab.lib.pagesizes import A4
@@ -21,9 +21,7 @@
 from reportlab.platypus.paragraph import Paragraph
 from reportlab.platypus.xpreformatted import XPreformatted
 from reportlab.platypus.frames import Frame
-from reportlab.platypus.doctemplate \
-     import PageTemplate, BaseDocTemplate
-
+from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
 from reportlab.graphics.charts.barcharts import VerticalBarChart
 from reportlab.graphics.charts.linecharts import HorizontalLineChart
 from reportlab.graphics.charts.lineplots import LinePlot
--- a/tests/test_graphics_images.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_graphics_images.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,12 +3,10 @@
 """
 Tests for RLG Image shapes.
 """
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import os
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.graphics.shapes import Image, Drawing
 from reportlab.graphics import renderPDF
 from reportlab.lib.pagesizes import A4
--- a/tests/test_graphics_layout.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_graphics_layout.py	Mon Sep 15 11:03:17 2008 +0000
@@ -5,7 +5,8 @@
 """
 
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
+setOutDir(__name__)
 
 from reportlab.graphics import shapes
 ##from reportlab.graphics.charts.barcharts import VerticalBarChart
--- a/tests/test_graphics_speed.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_graphics_speed.py	Mon Sep 15 11:03:17 2008 +0000
@@ -5,10 +5,11 @@
 with and without attribute checking.
 """
 __version__ = '''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import os, sys, time
 import reportlab.rl_config
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.lib import colors
 from reportlab.lib.units import cm
 from reportlab.pdfgen.canvas import Canvas
--- a/tests/test_hello.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_hello.py	Mon Sep 15 11:03:17 2008 +0000
@@ -6,12 +6,11 @@
 
 Useful if you want to test that a really minimal PDF is healthy,
 since the output is about the smallest thing we can make."""
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.pdfgen.canvas import Canvas
 
-
 class HelloTestCase(unittest.TestCase):
     "Simplest test that makes PDF"
 
--- a/tests/test_images.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_images.py	Mon Sep 15 11:03:17 2008 +0000
@@ -5,10 +5,10 @@
 __doc__="""Tests to do with image handling.
 
 Most of them make use of test\pythonpowereed.gif."""
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation, testsFolder
+setOutDir(__name__)
 import os,md5
-
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation, testsFolder
 from reportlab.lib.utils import ImageReader
 
 
--- a/tests/test_invariant.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_invariant.py	Mon Sep 15 11:03:17 2008 +0000
@@ -4,10 +4,11 @@
 __doc__="""Verfy that if in invariant mode, repeated runs
 make identical file.  This does NOT test across platforms
 or python versions, only a user can do that :-)"""
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, testsFolder
+setOutDir(__name__)
 
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, testsFolder
 from reportlab.pdfgen.canvas import Canvas
 filename = outputfile('test_invariant.pdf')
 
--- a/tests/test_lib_colors.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_lib_colors.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,10 +2,11 @@
 #see license.txt for license details
 """Tests for the reportlab.lib.colors module.
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import os, math
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.pdfgen.canvas import Canvas
 import reportlab.pdfgen.canvas
 from reportlab.lib import colors
--- a/tests/test_lib_sequencer.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_lib_sequencer.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,10 +2,11 @@
 #see license.txt for license details
 """Tests for the reportlab.lib.sequencer module.
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
+setOutDir(__name__)
 import sys, random
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation
 from reportlab.lib.sequencer import Sequencer
 
 
--- a/tests/test_lib_utils.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_lib_utils.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,10 +3,11 @@
 """Tests for reportlab.lib.utils
 """
 __version__=''' $Id$ '''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation, testsFolder
+setOutDir(__name__)
 import os
 import reportlab
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation, testsFolder
 from reportlab.lib import colors
 from reportlab.lib.utils import recursiveImport, recursiveGetAttr, recursiveSetAttr, rl_isfile, \
                                 isCompactDistro
--- a/tests/test_lib_validators.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_lib_validators.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,12 +1,11 @@
 """Tests (incomplete) for the reportlab.lib.validators module.
 """
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation
 from reportlab.lib import colors
 from reportlab.lib import validators
 
-
 class ValidatorTestCase(unittest.TestCase):
     "Test validating functions."
 
--- a/tests/test_multibyte_chs.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_multibyte_chs.py	Mon Sep 15 11:03:17 2008 +0000
@@ -6,13 +6,11 @@
 The code in this module will disappear any day now and be replaced
 by classes in reportlab.pdfbase.cidfonts
 """
-
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import string, os
 import codecs
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.lib import colors
@@ -21,7 +19,6 @@
 global VERBOSE
 VERBOSE = 0
 
-
 class CHSFontTests(unittest.TestCase):
 
     def test0(self):
--- a/tests/test_multibyte_cht.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_multibyte_cht.py	Mon Sep 15 11:03:17 2008 +0000
@@ -5,13 +5,10 @@
 """
 Test of traditional Chinese (as written in Taiwan)
 """
-
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import string, os
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.lib import colors
--- a/tests/test_multibyte_jpn.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_multibyte_jpn.py	Mon Sep 15 11:03:17 2008 +0000
@@ -6,13 +6,10 @@
 The code in this module will disappear any day now and be replaced
 by classes in reportlab.pdfbase.cidfonts
 """
-
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import string, os
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.lib import colors
--- a/tests/test_multibyte_kor.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_multibyte_kor.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,9 +1,7 @@
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import string, os
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.lib import colors
@@ -12,8 +10,6 @@
 global VERBOSE
 VERBOSE = 0
 
-
-
 class KoreanFontTests(unittest.TestCase):
 
     def test0(self):
--- a/tests/test_paragraphs.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_paragraphs.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,11 +1,10 @@
 #Copyright ReportLab Europe Ltd. 2000-2004
 #see license.txt for license details
 # tests some paragraph styles
-__version__='''$Id:$'''
-
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.platypus import Paragraph, SimpleDocTemplate, XBox, Indenter, XPreformatted
 from reportlab.lib.styles import ParagraphStyle
 from reportlab.lib.units import inch
@@ -15,7 +14,6 @@
 
 (PAGE_WIDTH, PAGE_HEIGHT) = defaultPageSize
 
-
 def myFirstPage(canvas, doc):
     canvas.saveState()
     canvas.setStrokeColor(red)
--- a/tests/test_pdfbase_encodings.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfbase_encodings.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,11 +1,10 @@
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, NearTestCase
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, NearTestCase
-
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfbase.ttfonts import TTFont
 from reportlab.pdfbase import pdfutils
-
 from reportlab.platypus.paragraph import Paragraph
 from reportlab.lib.styles import ParagraphStyle
 from reportlab.graphics.shapes import Drawing, String, Ellipse
--- a/tests/test_pdfbase_fontembed.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfbase_fontembed.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,13 +1,11 @@
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import os
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.pdfbase import pdfmetrics
 from tests.test_pdfbase_pdfmetrics import makeWidthTestForAllGlyphs
 
-
 class EmbeddingTestCase(unittest.TestCase):
     "Make documents with embedded fonts"
 
--- a/tests/test_pdfbase_pdfmetrics.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfbase_pdfmetrics.py	Mon Sep 15 11:03:17 2008 +0000
@@ -7,9 +7,10 @@
 The main test prints out a PDF documents enabling checking of widths of every
 glyph in every standard font.  Long!
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfbase import _fontdata
 from reportlab.pdfgen.canvas import Canvas
--- a/tests/test_pdfbase_pdfutils.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfbase_pdfutils.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,10 +2,11 @@
 #see license.txt for license details
 """Tests for utility functions in reportlab.pdfbase.pdfutils.
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
+setOutDir(__name__)
 import os
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation
 from reportlab.pdfbase.pdfutils import _AsciiHexEncode, _AsciiHexDecode
 from reportlab.pdfbase.pdfutils import _AsciiBase85Encode, _AsciiBase85Decode
 
--- a/tests/test_pdfbase_postscript.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfbase_postscript.py	Mon Sep 15 11:03:17 2008 +0000
@@ -6,13 +6,12 @@
 Nothing visiblke in Acrobat, but the resulting files
 contain graphics and tray commands if exported to
 a Postscript device in Acrobat 4.0"""
-__version__='''$Id:$'''
-
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.pdfgen.canvas import Canvas
 
-
 class PostScriptTestCase(unittest.TestCase):
     "Simplest test that makes PDF"
 
--- a/tests/test_pdfbase_ttfonts.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfbase_ttfonts.py	Mon Sep 15 11:03:17 2008 +0000
@@ -4,13 +4,11 @@
 This test uses a sample font (Vera.ttf) taken from Bitstream which is called Vera
 Serif Regular and is covered under the license in ../fonts/bitstream-vera-license.txt.
 """
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, NearTestCase
+setOutDir(__name__)
 import string
 from cStringIO import StringIO
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, NearTestCase
-
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfbase.pdfdoc import PDFDocument, PDFError
--- a/tests/test_pdfgen_callback.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfgen_callback.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,16 +3,14 @@
 #see license.txt for license details
 __doc__='checks callbacks work'
 __version__=''' $Id$ '''
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfgen.canvas import Canvas
 from tests.test_pdfgen_general import makeDocument
 
 _PAGE_COUNT = 0
 
-
 class CallBackTestCase(unittest.TestCase):
     "checks it gets called"
 
--- a/tests/test_pdfgen_general.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfgen_general.py	Mon Sep 15 11:03:17 2008 +0000
@@ -4,9 +4,10 @@
 __doc__='testscript for reportlab.pdfgen'
 __version__=''' $Id$ '''
 #tests and documents new low-level canvas
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, testsFolder
+setOutDir(__name__)
 import os, string
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, testsFolder
 from reportlab.pdfgen import canvas   # gmcm 2000/10/13, pdfgen now a package
 from reportlab.lib.units import inch, cm
 from reportlab.lib import colors
--- a/tests/test_pdfgen_links.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfgen_links.py	Mon Sep 15 11:03:17 2008 +0000
@@ -4,7 +4,9 @@
 """
 Tests for internal links and destinations
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 
 #
 # Fit tests
@@ -22,7 +24,6 @@
 from reportlab.lib import colors
 
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 
 def markPage(c,height=letter[1],width=letter[0]):
     height = height / inch
--- a/tests/test_pdfgen_pagemodes.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfgen_pagemodes.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,14 +3,13 @@
 # full screen test
 """Tests for PDF page modes support in reportlab.pdfgen.
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import os
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfgen.canvas import Canvas
 
-
 def fileDoesExist(path):
     "Check if a file does exist."
     return os.path.exists(path)
--- a/tests/test_pdfgen_pycanvas.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pdfgen_pycanvas.py	Mon Sep 15 11:03:17 2008 +0000
@@ -4,10 +4,9 @@
 __version__=''' $Id$ '''
 __doc__='testscript for reportlab.pdfgen'
 #tests and documents new low-level canvas and the pycanvas module to output Python source code.
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, testsFolder
+setOutDir(__name__)
 import string, os, unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, testsFolder
-
 from reportlab.pdfgen import pycanvas   # gmcm 2000/10/13, pdfgen now a package
 from reportlab.lib.units import inch, cm
 from reportlab.lib import colors
--- a/tests/test_platypus_breaking.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_breaking.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,15 +2,14 @@
 #see license.txt for license details
 """Tests pageBreakBefore, frameBreakBefore, keepWithNext...
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import sys, os, time
 from string import split, strip, join, whitespace
 from operator import truth
 from types import StringType, ListType
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.platypus.flowables import Flowable
 from reportlab.lib import colors
 from reportlab.lib.units import cm
--- a/tests/test_platypus_general.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_general.py	Mon Sep 15 11:03:17 2008 +0000
@@ -11,8 +11,9 @@
 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, testsFolder
+setOutDir(__name__)
 import string, copy, sys, os
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, testsFolder
 from reportlab.pdfgen import canvas
 from reportlab import platypus
 from reportlab.platypus import BaseDocTemplate, PageTemplate, Flowable, FrameBreak
--- a/tests/test_platypus_indents.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_indents.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,16 +2,14 @@
 #see license.txt for license details
 """Tests for context-dependent indentation
 """
-__version__='''$Id:$'''
-
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import sys, os, random
 from string import split, strip, join, whitespace
 from operator import truth
 from types import StringType, ListType
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.pdfbase.pdfmetrics import stringWidth
 from reportlab.platypus.paraparser import ParaParser
 from reportlab.platypus.flowables import Flowable
--- a/tests/test_platypus_leftright.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_leftright.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,14 +2,14 @@
 #see license.txt for license details
 """Tests ability to cycle through multiple page templates
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import sys, os, time
 from string import split, strip, join, whitespace
 from operator import truth
 from types import StringType, ListType
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.platypus.flowables import Flowable
 from reportlab.lib import colors
 from reportlab.lib.pagesizes import A4
--- a/tests/test_platypus_paragraphs.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_paragraphs.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,13 +3,12 @@
 """Tests for the reportlab.platypus.paragraphs module.
 """
 __version__=''' $Id$ '''
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, testsFolder
+setOutDir(__name__)
 import sys, os, unittest
 from string import split, strip, join, whitespace
 from operator import truth
 from types import StringType, ListType
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, testsFolder
-
 from reportlab.pdfbase.pdfmetrics import stringWidth, registerFont, registerFontFamily
 from reportlab.pdfbase.ttfonts import TTFont
 from reportlab.platypus.paraparser import ParaParser
--- a/tests/test_platypus_paraparser.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_paraparser.py	Mon Sep 15 11:03:17 2008 +0000
@@ -5,12 +5,11 @@
 #$Header$
 __version__=''' $Id'''
 __doc__="""Tests of intra-paragraph parsing behaviour in Platypus."""
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile
+setOutDir(__name__)
 from types import TupleType, ListType, StringType, UnicodeType
 from pprint import pprint as pp
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile
 from reportlab.platypus import cleanBlockQuotedText
 from reportlab.platypus.paraparser import ParaParser, ParaFrag
 from reportlab.lib.colors import black
--- a/tests/test_platypus_pleaseturnover.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_pleaseturnover.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,10 +2,11 @@
 #see license.txt for license details
 """Tests pleaseTurnOver, pageBreakBefore, frameBreakBefore, keepWithNext...
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import sys
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.platypus.flowables import Flowable, PTOContainer, KeepInFrame
 from reportlab.lib.units import cm
 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
--- a/tests/test_platypus_tables.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_tables.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,14 +3,13 @@
 #see license.txt for license details
 __version__=''' $Id$ '''
 __doc__='Test script for reportlab.tables'
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, testsFolder
+setOutDir(__name__)
 import os,unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, testsFolder
 from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle
 from reportlab.lib.units import inch, cm
 from reportlab.lib import colors
 
-
 def getTable():
     t = Table((('','North','South','East','West'),
              ('Quarter 1',100,200,300,400),
--- a/tests/test_platypus_toc.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_toc.py	Mon Sep 15 11:03:17 2008 +0000
@@ -6,14 +6,13 @@
 one, will be generating a PDF document that needs to be eye-balled
 in order to find out if it is 'correct'.
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import sys, os
 from os.path import join, basename, splitext
 from math import sqrt
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.lib.units import inch, cm
 from reportlab.lib.pagesizes import A4
 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
--- a/tests/test_platypus_xref.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_platypus_xref.py	Mon Sep 15 11:03:17 2008 +0000
@@ -2,13 +2,14 @@
 #see license.txt for license details
 """Test long documents with indexes, tables and cross-references
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import sys, os, time
 from string import split, strip, join, whitespace, find
 from operator import truth
 from types import StringType, ListType
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
 from reportlab.lib import colors
 from reportlab.lib.units import cm
 from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
@@ -18,7 +19,6 @@
 from reportlab.lib.randomtext import randomText, PYTHON
 from reportlab.platypus.tableofcontents import TableOfContents, SimpleIndex
 
-
 def myMainPageFrame(canvas, doc):
     "The page frame used for all PDF documents."
 
--- a/tests/test_pyfiles.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_pyfiles.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,9 +3,10 @@
 __version__=''' $Id$ '''
 """Tests performed on all Python source files of the ReportLab distribution.
 """
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, SecureTestCase, GlobDirectoryWalker, outputfile, printLocation, RL_HOME
+setOutDir(__name__)
 import os, sys, string, fnmatch, re
 import unittest
-from tests.utils import makeSuiteForClasses, SecureTestCase, GlobDirectoryWalker, outputfile, printLocation, RL_HOME
 from reportlab.lib.utils import open_and_read, open_and_readlines
 
 # Helper function and class.
--- a/tests/test_renderSVG.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_renderSVG.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,18 +1,13 @@
 #!/usr/bin/env python
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import sys, string
 from xml.dom import minidom
 from xml.sax._exceptions import SAXReaderNotAvailable
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.graphics.shapes import *
 from reportlab.graphics import renderSVG
 
-
-
-
 def warnIgnoredRestofTest():
     "Raise a warning (if possible) about a not fully completed test."
 
@@ -25,11 +20,7 @@
         # should better also be printed only once...
         print msg
 
-
-
-
 # Check if we have a default XML parser available or not.
-
 try:
     import xml
     from xml.sax import make_parser
@@ -38,9 +29,6 @@
 except SAXReaderNotAvailable:
     HAVE_XML_PARSER = 0
 
-
-
-
 def load(path):
     "Helper function to read the generated SVG again."
 
@@ -48,9 +36,6 @@
     doc.normalize()
     return doc.documentElement
 
-
-
-
 class RenderSvgSimpleTestCase(unittest.TestCase):
     "Testing renderSVG module."
 
@@ -77,7 +62,6 @@
         assert t0 == 'foo'
         assert t1 == 'bar'
 
-
     def test1(self):
         "Test two strings in group in drawing."
 
@@ -105,7 +89,6 @@
         assert t0 == 'foo'
         assert t1 == 'bar'
 
-
     def test2(self):
         "Test two strings in transformed group in drawing."
 
@@ -135,9 +118,6 @@
         assert t0 == 'foo'
         assert t1 == 'bar'
 
-
-
-
 class RenderSvgAxesTestCase(unittest.TestCase):
     "Testing renderSVG module on Axes widgets."
 
@@ -150,15 +130,9 @@
         d = XCategoryAxis().demo()
         renderSVG.drawToFile(d, path)
 
-
-
-
 def makeSuite():
     return makeSuiteForClasses(RenderSvgSimpleTestCase, RenderSvgAxesTestCase)
 
-
-
-
 #noruntests
 if __name__ == "__main__":
     unittest.TextTestRunner().run(makeSuite())
--- a/tests/test_rl_accel.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_rl_accel.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,8 +1,9 @@
 __version__=''' $Id'''
 __doc__='''basic tests.'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
+setOutDir(__name__)
 
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation
 
 def getrc(defns,depth=1):
     from sys import getrefcount, _getframe
--- a/tests/test_source_chars.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_source_chars.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,12 +3,13 @@
 #see license.txt for license details
 """This tests for things in source files.  Initially, absence of tabs :-)
 """
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, SecureTestCase, GlobDirectoryWalker, printLocation, testsFolder, RL_HOME
+setOutDir(__name__)
 __version__=''' $Id$ '''
 import os, sys, glob, string, re
 from types import ModuleType, ClassType, MethodType, FunctionType
 import reportlab
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, SecureTestCase, GlobDirectoryWalker, printLocation, testsFolder, RL_HOME
 from reportlab.lib.utils import open_and_read
 
 
--- a/tests/test_table_layout.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_table_layout.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,5 +1,6 @@
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import operator, string
-
 from reportlab.platypus import *
 #from reportlab import rl_config
 from reportlab.lib.styles import PropertySet, getSampleStyleSheet, ParagraphStyle
@@ -8,17 +9,10 @@
 #from reportlab.lib.utils import fp_str
 #from reportlab.pdfbase import pdfmetrics
 from reportlab.platypus.flowables import PageBreak
-
-
 import os
-
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
-
 from types import TupleType, ListType, StringType
 
-
 class TableTestCase(unittest.TestCase):
 
 
--- a/tests/test_tools_pythonpoint.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_tools_pythonpoint.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,8 +1,9 @@
 """Tests for the PythonPoint tool.
 """
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, testsFolder
+setOutDir(__name__)
 import os, sys, string
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation, testsFolder
 import reportlab
 
 class PythonPointTestCase(unittest.TestCase):
--- a/tests/test_utils.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_utils.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,10 +3,9 @@
 #see license.txt for license details
 __version__='''$Id$'''
 __doc__="""Test reportlab.lib.util module"""
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 
 class FmtTestCase(unittest.TestCase):
 
--- a/tests/test_widgetbase_tpc.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_widgetbase_tpc.py	Mon Sep 15 11:03:17 2008 +0000
@@ -3,11 +3,12 @@
 """
 Tests for TypedPropertyCollection class.
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
+setOutDir(__name__)
 import os, sys, copy
 from os.path import join, basename, splitext
 import unittest
-from tests.utils import makeSuiteForClasses, printLocation
 from reportlab.graphics.widgetbase import PropHolder, TypedPropertyCollection
 from reportlab.lib.attrmap import AttrMap, AttrMapValue
 from reportlab.lib.validators import isNumber
--- a/tests/test_widgets_grids.py	Fri Sep 12 16:19:39 2008 +0000
+++ b/tests/test_widgets_grids.py	Mon Sep 15 11:03:17 2008 +0000
@@ -1,7 +1,6 @@
-
+from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
+setOutDir(__name__)
 import unittest
-from tests.utils import makeSuiteForClasses, outputfile, printLocation
-
 from reportlab.lib import colors
 from reportlab.graphics.shapes import Drawing, Group, Line, Rect
 from reportlab.graphics.widgetbase import Widget
--- a/tests/utils.py	Fri Sep 12 16:19:39 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,329 +0,0 @@
-#Copyright ReportLab Europe Ltd. 2000-2008
-#see license.txt for license details
-"""Utilities for testing Python packages.
-"""
-__version__='''$Id:$'''
-import sys, os, string, fnmatch, copy, re
-from ConfigParser import ConfigParser
-import unittest
-
-# Helper functions.
-def isWritable(D):
-    try:
-        fn = '00DELETE.ME'
-        f = open(fn, 'w')
-        f.write('test of writability - can be deleted')
-        f.close()
-        if os.path.isfile(fn):
-            os.remove(fn)
-            return 1
-    except:
-        return 0
-
-_TEST_DIR_IS_WRITABLE = None  #not known yet
-_OUTDIR = None
-def canWriteTestOutputHere():
-    """Is it a writable file system distro being invoked within
-    test directory?  If so, can write test output here.  If not,
-    it had better go in a temp directory.  Only do this once per
-    process"""
-
-    global _TEST_DIR_IS_WRITABLE, _OUTDIR
-    if _TEST_DIR_IS_WRITABLE is not None:
-        return _TEST_DIR_IS_WRITABLE
-
-    D = [d[9:] for d in sys.argv if d.startswith('--outdir=')]
-    if D:
-        _OUTDIR = D[-1]
-        try:
-            os.makedirs(_OUTDIR)
-        except:
-            pass
-        map(sys.argv.remove,D)
-        _TEST_DIR_IS_WRITABLE = isWritable(_OUTDIR)
-    else:
-        from reportlab.lib.utils import isSourceDistro
-        if isSourceDistro():
-            curDir = os.getcwd()
-            parentDir = os.path.dirname(curDir)
-            if curDir.endswith('test') and parentDir.endswith('reportlab'):
-                #we're probably being run within the test directory.
-                #now check it's writeable.
-                _TEST_DIR_IS_WRITABLE = isWritable(curDir)
-                _OUTDIR = curDir
-    return _TEST_DIR_IS_WRITABLE
-
-def outputfile(fn):
-    """This works out where to write test output.  If running
-    code in a zip file or a locked down file system, this will be a
-    temp directory; otherwise, the output of 'test_foo.py' will
-    normally be a file called 'test_foo.pdf', next door.
-    """
-    if canWriteTestOutputHere():
-        D = _OUTDIR
-    else:
-        from reportlab.lib.utils import isSourceDistro, get_rl_tempdir
-        D = get_rl_tempdir('reportlab_test')
-    if fn: D = os.path.join(D,fn)
-    return D
-
-def printLocation(depth=1):
-    if sys._getframe(depth).f_locals.get('__name__')=='__main__':
-        outDir = outputfile('')
-        if outDir!=_OUTDIR:
-            print 'Logs and output files written to folder "%s"' % outDir
-
-def makeSuiteForClasses(*classes):
-    "Return a test suite with tests loaded from provided classes."
-
-    suite = unittest.TestSuite()
-    loader = unittest.TestLoader()
-    for C in classes:
-        suite.addTest(loader.loadTestsFromTestCase(C))
-    return suite
-
-def getCVSEntries(folder, files=1, folders=0):
-    """Returns a list of filenames as listed in the CVS/Entries file.
-
-    'folder' is the folder that should contain the CVS subfolder.
-    If there is no such subfolder an empty list is returned.
-    'files' is a boolean; 1 and 0 means to return files or not.
-    'folders' is a boolean; 1 and 0 means to return folders or not.
-    """
-
-    join = os.path.join
-    split = string.split
-
-    # If CVS subfolder doesn't exist return empty list.
-    try:
-        f = open(join(folder, 'CVS', 'Entries'))
-    except IOError:
-        return []
-
-    # Return names of files and/or folders in CVS/Entries files.
-    allEntries = []
-    for line in f.readlines():
-        if folders and line[0] == 'D' \
-           or files and line[0] != 'D':
-            entry = split(line, '/')[1]
-            if entry:
-                allEntries.append(join(folder, entry))
-
-    return allEntries
-
-
-# Still experimental class extending ConfigParser's behaviour.
-class ExtConfigParser(ConfigParser):
-    "A slightly extended version to return lists of strings."
-
-    pat = re.compile('\s*\[.*\]\s*')
-
-    def getstringlist(self, section, option):
-        "Coerce option to a list of strings or return unchanged if that fails."
-
-        value = apply(ConfigParser.get, (self, section, option))
-
-        # This seems to allow for newlines inside values
-        # of the config file, but be careful!!
-        val = string.replace(value, '\n', '')
-
-        if self.pat.match(val):
-            return eval(val)
-        else:
-            return value
-
-
-# This class as suggested by /F with an additional hook
-# to be able to filter filenames.
-
-class GlobDirectoryWalker:
-    "A forward iterator that traverses files in a directory tree."
-
-    def __init__(self, directory, pattern='*'):
-        self.index = 0
-        self.pattern = pattern
-        directory.replace('/',os.sep)
-        if os.path.isdir(directory):
-            self.stack = [directory]
-            self.files = []
-        else:
-            from reportlab.lib.utils import isCompactDistro, __loader__, rl_isdir
-            if not isCompactDistro() or not __loader__ or not rl_isdir(directory):
-                raise ValueError('"%s" is not a directory' % directory)
-            self.directory = directory[len(__loader__.archive)+len(os.sep):]
-            pfx = self.directory+os.sep
-            n = len(pfx)
-            self.files = map(lambda x, n=n: x[n:],filter(lambda x,pfx=pfx: x.startswith(pfx),__loader__._files.keys()))
-            self.stack = []
-
-    def __getitem__(self, index):
-        while 1:
-            try:
-                file = self.files[self.index]
-                self.index = self.index + 1
-            except IndexError:
-                # pop next directory from stack
-                self.directory = self.stack.pop()
-                self.files = os.listdir(self.directory)
-                # now call the hook
-                self.files = self.filterFiles(self.directory, self.files)
-                self.index = 0
-            else:
-                # got a filename
-                fullname = os.path.join(self.directory, file)
-                if os.path.isdir(fullname) and not os.path.islink(fullname):
-                    self.stack.append(fullname)
-                if fnmatch.fnmatch(file, self.pattern):
-                    return fullname
-
-    def filterFiles(self, folder, files):
-        "Filter hook, overwrite in subclasses as needed."
-
-        return files
-
-
-class RestrictedGlobDirectoryWalker(GlobDirectoryWalker):
-    "An restricted directory tree iterator."
-
-    def __init__(self, directory, pattern='*', ignore=None):
-        apply(GlobDirectoryWalker.__init__, (self, directory, pattern))
-
-        if ignore == None:
-            ignore = []
-        self.ignoredPatterns = []
-        if type(ignore) == type([]):
-            for p in ignore:
-                self.ignoredPatterns.append(p)
-        elif type(ignore) == type(''):
-            self.ignoredPatterns.append(ignore)
-
-
-    def filterFiles(self, folder, files):
-        "Filters all items from files matching patterns to ignore."
-
-        indicesToDelete = []
-        for i in xrange(len(files)):
-            f = files[i]
-            for p in self.ignoredPatterns:
-                if fnmatch.fnmatch(f, p):
-                    indicesToDelete.append(i)
-        indicesToDelete.reverse()
-        for i in indicesToDelete:
-            del files[i]
-
-        return files
-
-
-class CVSGlobDirectoryWalker(GlobDirectoryWalker):
-    "An directory tree iterator that checks for CVS data."
-
-    def filterFiles(self, folder, files):
-        """Filters files not listed in CVS subfolder.
-
-        This will look in the CVS subfolder of 'folder' for
-        a file named 'Entries' and filter all elements from
-        the 'files' list that are not listed in 'Entries'.
-        """
-
-        join = os.path.join
-        cvsFiles = getCVSEntries(folder)
-        if cvsFiles:
-            indicesToDelete = []
-            for i in xrange(len(files)):
-                f = files[i]
-                if join(folder, f) not in cvsFiles:
-                    indicesToDelete.append(i)
-            indicesToDelete.reverse()
-            for i in indicesToDelete:
-                del files[i]
-
-        return files
-
-
-# An experimental untested base class with additional 'security'.
-
-class SecureTestCase(unittest.TestCase):
-    """Secure testing base class with additional pre- and postconditions.
-
-    We try to ensure that each test leaves the environment it has
-    found unchanged after the test is performed, successful or not.
-
-    Currently we restore sys.path and the working directory, but more
-    of this could be added easily, like removing temporary files or
-    similar things.
-
-    Use this as a base class replacing unittest.TestCase and call
-    these methods in subclassed versions before doing your own
-    business!
-    """
-
-    def setUp(self):
-        "Remember sys.path and current working directory."
-
-        self._initialPath = copy.copy(sys.path)
-        self._initialWorkDir = os.getcwd()
-
-
-    def tearDown(self):
-        "Restore previous sys.path and working directory."
-
-        sys.path = self._initialPath
-        os.chdir(self._initialWorkDir)
-
-class NearTestCase(unittest.TestCase):
-    def assertNear(a,b,accuracy=1e-5):
-        if isinstance(a,(float,int)):
-            if abs(a-b)>accuracy:
-                raise AssertionError("%s not near %s" % (a, b))
-        else:
-            for ae,be in zip(a,b):
-                if abs(ae-be)>accuracy:
-                    raise AssertionError("%s not near %s" % (a, b))
-    assertNear = staticmethod(assertNear)
-
-class ScriptThatMakesFileTest(unittest.TestCase):
-    """Runs a Python script at OS level, expecting it to produce a file.
-
-    It CDs to the working directory to run the script."""
-    def __init__(self, scriptDir, scriptName, outFileName, verbose=0):
-        self.scriptDir = scriptDir
-        self.scriptName = scriptName
-        self.outFileName = outFileName
-        self.verbose = verbose
-        # normally, each instance is told which method to run)
-        unittest.TestCase.__init__(self)
-
-    def setUp(self):
-        self.cwd = os.getcwd()
-        from tests.utils import testsFolder
-        scriptDir=self.scriptDir
-        if not os.path.isabs(scriptDir):
-            scriptDir=os.path.join(testsFolder,scriptDir)
-
-        os.chdir(scriptDir)
-        assert os.path.isfile(self.scriptName), "Script %s not found!" % self.scriptName
-        if os.path.isfile(self.outFileName):
-            os.remove(self.outFileName)
-
-    def tearDown(self):
-        os.chdir(self.cwd)
-
-    def runTest(self):
-        fmt = sys.platform=='win32' and '"%s" %s' or '%s %s'
-        p = os.popen(fmt % (sys.executable,self.scriptName),'r')
-        out = p.read()
-        if self.verbose:
-            print out
-        status = p.close()
-        assert os.path.isfile(self.outFileName), "File %s not created!" % self.outFileName
-
-import tests as testsFolder
-testsFolder=testsFolder.__path__[0]
-if not os.path.isabs(testsFolder): testsFolder=os.path.normpath(os.path.abspath(testsFolder))
-RL_HOME=os.path.join(testsFolder,'src','reportlab')
-if not os.path.isdir(RL_HOME):
-    RL_HOME=os.path.join(testsFolder,'reportlab')
-if not os.path.isdir(RL_HOME):
-    import reportlab as RL_HOME
-    RL_HOME=RL_HOME.__path__[0]
-    if not os.path.isabs(RL_HOME): RL_HOME=os.path.normpath(os.path.abspath(RL_HOME))