[Checkins] SVN: z3c.pt/trunk/benchmark/benchmark/tests.py Don't fail hard if lxml fails to load.

Malthe Borch mborch at gmail.com
Thu Oct 8 10:40:13 EDT 2009


Log message for revision 104928:
  Don't fail hard if lxml fails to load.

Changed:
  U   z3c.pt/trunk/benchmark/benchmark/tests.py

-=-
Modified: z3c.pt/trunk/benchmark/benchmark/tests.py
===================================================================
--- z3c.pt/trunk/benchmark/benchmark/tests.py	2009-10-08 14:30:50 UTC (rev 104927)
+++ z3c.pt/trunk/benchmark/benchmark/tests.py	2009-10-08 14:40:13 UTC (rev 104928)
@@ -14,7 +14,10 @@
 
 from z3c.pt import pagetemplate
 
-from lxml import etree
+try:
+    from lxml import etree
+except ImportError:
+    etree = None
 
 class test_request:
     response = None
@@ -177,8 +180,12 @@
 
         t_z3c = timing(self.bigtable_python_z3c, table=table)
         t_zope = timing(self.bigtable_python_zope, table=table)
-        t_lxml = timing(bigtable_python_lxml, table=table)
 
+        if etree:
+            t_lxml = timing(bigtable_python_lxml, table=table)
+        else:
+            t_lxml = 0.0
+
         print "zope.pagetemplate: %.2f" % t_zope
         print "lxml:              %.2f" % t_lxml
         print "--------------------------"



More information about the checkins mailing list