diff --git a/product/ERP5/tests/testXHTML.py b/product/ERP5/tests/testXHTML.py
index 3bd26125f8c79495e5bb5b269efc25fa1e0c5a70..be0642e99159511c01363af8ad6725264f1f97f8 100644
--- a/product/ERP5/tests/testXHTML.py
+++ b/product/ERP5/tests/testXHTML.py
@@ -562,14 +562,13 @@ elif validator_to_use == 'tidy':
   else:
     validator = TidyValidator(validator_path, show_warnings)
 
-if validator is not None:
-  # add erp5_core to the list here to not return it
-  # on getBusinessTemplateList call
-  addTestMethodDynamically(validator,
-    ('erp5_core',) + TestXHTML.getBusinessTemplateList())
-
 def test_suite():
   # add the tests
+  if validator is not None:
+    # add erp5_core to the list here to not return it
+    # on getBusinessTemplateList call
+    addTestMethodDynamically(validator,
+      ('erp5_core',) + TestXHTML.getBusinessTemplateList())
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestXHTML))
   return suite