[Zope-Checkins] CVS: Zope/lib/python/Products/PageTemplates/tests - testDTMLTests.py:1.3 testExpressions.py:1.8 testHTMLTests.py:1.8 testTALES.py:1.3 util.py:1.2

Tres Seaver tseaver@zope.com
Wed, 17 Oct 2001 16:01:04 -0400


Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests
In directory cvs.zope.org:/tmp/cvs-serv30119/lib/python/Products/PageTemplates/tests

Modified Files:
	testDTMLTests.py testExpressions.py testHTMLTests.py 
	testTALES.py util.py 
Log Message:


  o Land unit test cleanup from branch.

  o Known breakage as of 2001/10/17:

    - TAL test suite is very broken (TAL is currently suppressed in
      lib/python/.testinfo).

    - AccessControl tests don't run if run first;  lib/python/.testinfo
      pushes them to the end of the queue, at which point they *do* run.
      Global side effects suck!

    - lib/python/BTrees/testBTreesUnicode.py:  weird flakiness around
      comparison of ASCII and Unicode strings;  breaks in different
      ways under Python 2.1 and 2.2.

    - lib/python/Products/PageTemplates/tests:  three tests break due
      to security asserctions.


=== Zope/lib/python/Products/PageTemplates/tests/testDTMLTests.py 1.2 => 1.3 ===
 ##############################################################################
 
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import os, sys, unittest
 
-import util
+from Products.PageTemplates.tests import util
 from Products.PageTemplates.PageTemplate import PageTemplate
 from Acquisition import Implicit
 
@@ -120,18 +119,18 @@
       </body></html>
       """
 
-      tal = read_input('DTML1.html')
+      tal = util.read_input('DTML1.html')
       self.t.write(tal)
 
       aa=util.argv(('one', 'two', 'three', 'cha', 'cha', 'cha'))
       o=self.t.__of__(aa)()
-      expect = read_output('DTML1a.html')
+      expect = util.read_output('DTML1a.html')
 
       util.check_xml(expect, o)
 
       aa=util.argv(())
       o=self.t.__of__(aa)()
-      expect = read_output('DTML1b.html')
+      expect = util.read_output('DTML1b.html')
       util.check_xml(expect, o)
 
    def check3(self):
@@ -164,7 +163,7 @@
         </body></html>
       """
 
-      tal = read_input('DTML3.html')
+      tal = util.read_input('DTML3.html')
       self.t.write(tal)
 
       aa=util.argv(('one', 'two', 'three', 'four', 'five',
@@ -172,10 +171,10 @@
                     'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',
                     'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty',
                     ))
-      import batch        
+      from Products.PageTemplates.tests import batch        
       o=self.t.__of__(aa)(batch=batch.batch(aa.args, 5))
 
-      expect = read_output('DTML3.html')
+      expect = util.read_output('DTML3.html')
       util.check_xml(expect, o)
 
 def test_suite():


=== Zope/lib/python/Products/PageTemplates/tests/testExpressions.py 1.7 => 1.8 ===
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import os, sys, unittest
 
 from Products.PageTemplates import Expressions
 


=== Zope/lib/python/Products/PageTemplates/tests/testHTMLTests.py 1.7 => 1.8 ===
 ##############################################################################
 
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import os, sys, unittest
 
-import util
+from Products.PageTemplates.tests import util
 from Products.PageTemplates.PageTemplate import PageTemplate
 
 from Acquisition import Implicit
@@ -117,82 +116,82 @@
 
    def check1(self):
       laf = self.folder.laf
-      laf.write(read_input('TeeShopLAF.html'))
-      expect = read_output('TeeShopLAF.html')
+      laf.write(util.read_input('TeeShopLAF.html'))
+      expect = util.read_output('TeeShopLAF.html')
       util.check_html(expect, laf())
 
    def check2(self):
-      self.folder.laf.write(read_input('TeeShopLAF.html'))
+      self.folder.laf.write(util.read_input('TeeShopLAF.html'))
 
       t = self.folder.t
-      t.write(read_input('TeeShop2.html'))
-      expect = read_output('TeeShop2.html')
+      t.write(util.read_input('TeeShop2.html'))
+      expect = util.read_output('TeeShop2.html')
       out = t(getProducts=self.getProducts)
       util.check_html(expect, out)
       
 
    def check3(self):
-      self.folder.laf.write(read_input('TeeShopLAF.html'))
+      self.folder.laf.write(util.read_input('TeeShopLAF.html'))
 
       t = self.folder.t
-      t.write(read_input('TeeShop1.html'))
-      expect = read_output('TeeShop1.html')
+      t.write(util.read_input('TeeShop1.html'))
+      expect = util.read_output('TeeShop1.html')
       out = t(getProducts=self.getProducts)
       util.check_html(expect, out)
 
    def checkSimpleLoop(self):
       t = self.folder.t
-      t.write(read_input('Loop1.html'))
-      expect = read_output('Loop1.html')
+      t.write(util.read_input('Loop1.html'))
+      expect = util.read_output('Loop1.html')
       out = t()
       util.check_html(expect, out)
 
    def checkGlobalsShadowLocals(self):
       t = self.folder.t
-      t.write(read_input('GlobalsShadowLocals.html'))
-      expect = read_output('GlobalsShadowLocals.html')
+      t.write(util.read_input('GlobalsShadowLocals.html'))
+      expect = util.read_output('GlobalsShadowLocals.html')
       out = t()
       util.check_html(expect, out)
 
    def checkStringExpressions(self):
       t = self.folder.t
-      t.write(read_input('StringExpression.html'))
-      expect = read_output('StringExpression.html')
+      t.write(util.read_input('StringExpression.html'))
+      expect = util.read_output('StringExpression.html')
       out = t()
       util.check_html(expect, out)
       
    def checkReplaceWithNothing(self):
       t = self.folder.t
-      t.write(read_input('CheckNothing.html'))
-      expect = read_output('CheckNothing.html')
+      t.write(util.read_input('CheckNothing.html'))
+      expect = util.read_output('CheckNothing.html')
       out = t()
       util.check_html(expect, out)
 
    def checkWithXMLHeader(self):
       t = self.folder.t
-      t.write(read_input('CheckWithXMLHeader.html'))
-      expect = read_output('CheckWithXMLHeader.html')
+      t.write(util.read_input('CheckWithXMLHeader.html'))
+      expect = util.read_output('CheckWithXMLHeader.html')
       out = t()
       util.check_html(expect, out)
 
    def checkNotExpression(self):
       t = self.folder.t
-      t.write(read_input('CheckNotExpression.html'))
-      expect = read_output('CheckNotExpression.html')
+      t.write(util.read_input('CheckNotExpression.html'))
+      expect = util.read_output('CheckNotExpression.html')
       out = t()
       util.check_html(expect, out)
       
    def checkPathNothing(self):
       t = self.folder.t
-      t.write(read_input('CheckPathNothing.html'))
-      expect = read_output('CheckPathNothing.html')
+      t.write(util.read_input('CheckPathNothing.html'))
+      expect = util.read_output('CheckPathNothing.html')
       out = t()
       util.check_html(expect, out)
       
    def checkPathAlt(self):
       t = self.folder.t
-      t.write(read_input('CheckPathAlt.html'))
-      expect = read_output('CheckPathAlt.html')
+      t.write(util.read_input('CheckPathAlt.html'))
+      expect = util.read_output('CheckPathAlt.html')
       out = t()
       util.check_html(expect, out)
 


=== Zope/lib/python/Products/PageTemplates/tests/testTALES.py 1.2 => 1.3 ===
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import os, sys, unittest
 
 from Products.PageTemplates import TALES
 from Products.PageTemplates.tests import harness1


=== Zope/lib/python/Products/PageTemplates/tests/util.py 1.1 => 1.2 ===
     s = re.sub(r"(?s)>\s+", ">", s)
     return s
+
+
+import Products.PageTemplates.tests
+dir = os.path.dirname( Products.PageTemplates.tests.__file__)
+input_dir = os.path.join(dir, 'input')
+output_dir = os.path.join(dir, 'output')
+
+def read_input(filename):
+    filename = os.path.join(input_dir, filename)
+    return open(filename, 'r').read()
+
+def read_output(filename):
+    filename = os.path.join(output_dir, filename)
+    return open(filename, 'r').read()