Commit 396743f9 authored by Jérome Perrin's avatar Jérome Perrin

fix all name errors / unused imports in ERP5Type/tests



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16394 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 87997343
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
# #
############################################################################## ##############################################################################
import os
import sys
__version__ = '0.2.3' __version__ = '0.2.3'
# Save start state # Save start state
......
...@@ -32,15 +32,8 @@ ...@@ -32,15 +32,8 @@
# usage: python runUnitTest.py [OPTION]... namingConventionTest.py # usage: python runUnitTest.py [OPTION]... namingConventionTest.py
# #
import os
import sys
import re import re
if __name__ == '__main__': import unittest
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
...@@ -80,11 +73,7 @@ class TestNamingConvention(ERP5TypeTestCase): ...@@ -80,11 +73,7 @@ class TestNamingConvention(ERP5TypeTestCase):
problems = int(problems_re.search(result).group(1)) problems = int(problems_re.search(result).group(1))
self.assertEquals(0, problems, result) self.assertEquals(0, problems, result)
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestNamingConvention)) suite.addTest(unittest.makeSuite(TestNamingConvention))
return suite return suite
...@@ -33,14 +33,7 @@ ...@@ -33,14 +33,7 @@
# #
import os import os
import sys import unittest
from time import sleep
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
...@@ -63,11 +56,8 @@ class TestZelenium(ERP5TypeTestCase): ...@@ -63,11 +56,8 @@ class TestZelenium(ERP5TypeTestCase):
def testInformation(self): def testInformation(self):
self.assert_(False, 'This script is intended to be used with --save option.') self.assert_(False, 'This script is intended to be used with --save option.')
if __name__ == '__main__':
framework() def test_suite():
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestZelenium)) suite.addTest(unittest.makeSuite(TestZelenium))
return suite return suite
...@@ -31,10 +31,7 @@ ...@@ -31,10 +31,7 @@
import smtplib import smtplib
import re import re
from datetime import date
from email.MIMEText import MIMEText from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart from email.MIMEMultipart import MIMEMultipart
from email.Message import Message from email.Message import Message
......
...@@ -26,21 +26,14 @@ ...@@ -26,21 +26,14 @@
# #
############################################################################## ##############################################################################
import os, sys import time
if __name__ == '__main__': import unittest
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.CachePlugins.DummyCache import DummyCache from Products.ERP5Type.CachePlugins.DummyCache import DummyCache
from Products.ERP5Type.Cache import CachingMethod
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG from zLOG import LOG
import time
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
...@@ -284,11 +277,7 @@ return result ...@@ -284,11 +277,7 @@ return result
## Cache cleared shouldn't be previously cached ## Cache cleared shouldn't be previously cached
self.assert_(1.0 < calculation_time) self.assert_(1.0 < calculation_time)
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCacheTool)) suite.addTest(unittest.makeSuite(TestCacheTool))
return suite return suite
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
# #
############################################################################## ##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
......
...@@ -31,7 +31,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase ...@@ -31,7 +31,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import installRealClassTool from Products.ERP5Type.tests.utils import installRealClassTool
from zLOG import LOG from zLOG import LOG
import time
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
......
...@@ -25,17 +25,11 @@ ...@@ -25,17 +25,11 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder import unittest
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase
from AccessControl.SecurityManagement import newSecurityManager, \ from AccessControl.SecurityManagement import newSecurityManager
noSecurityManager
from Products.ERP5Type.tests.Sequence import Sequence, SequenceList from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
class TestConstraint(PropertySheetTestCase): class TestConstraint(PropertySheetTestCase):
...@@ -1314,11 +1308,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1314,11 +1308,7 @@ class TestConstraint(PropertySheetTestCase):
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConstraint)) suite.addTest(unittest.makeSuite(TestConstraint))
return suite return suite
...@@ -26,22 +26,14 @@ ...@@ -26,22 +26,14 @@
# #
############################################################################## ##############################################################################
import os
import sys
import md5 import md5
if __name__ == '__main__': import unittest
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from random import randint from random import randint
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG, INFO from zLOG import LOG, INFO
from Products.CMFCore.tests.base.testcase import LogInterceptor from Products.CMFCore.tests.base.testcase import LogInterceptor
from Products.ERP5Type.Cache import CachingMethod, clearCache
from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.Base import _aq_reset
from Products.ERP5Type.tests.utils import installRealClassTool from Products.ERP5Type.tests.utils import installRealClassTool
from Products.ERP5Type.Utils import removeLocalPropertySheet from Products.ERP5Type.Utils import removeLocalPropertySheet
...@@ -1355,11 +1347,7 @@ class TestPropertySheet: ...@@ -1355,11 +1347,7 @@ class TestPropertySheet:
obj.setFooBar('something') obj.setFooBar('something')
self.assertTrue(obj.hasFooBar()) self.assertTrue(obj.hasFooBar())
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Type)) suite.addTest(unittest.makeSuite(TestERP5Type))
return suite return suite
##############################################################################
# #
# ERP5 Folder unit test suite. # Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Yoshinori Okuji <yo@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os, sys import unittest
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG from zLOG import LOG
...@@ -152,11 +170,7 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): ...@@ -152,11 +170,7 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
self.assertRaises(ValueError, self.folder.newContent, self.assertRaises(ValueError, self.folder.newContent,
portal_type='Category') portal_type='Category')
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolder)) suite.addTest(unittest.makeSuite(TestFolder))
return suite return suite
# -*- coding: latin1 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
...@@ -26,19 +27,11 @@ ...@@ -26,19 +27,11 @@
# #
############################################################################## ##############################################################################
import os, sys import unittest
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG from zLOG import LOG
from Products.CMFCore.tests.base.testcase import LogInterceptor from Products.CMFCore.tests.base.testcase import LogInterceptor
from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type.Cache import clearCache from Products.ERP5Type.Cache import clearCache
class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
...@@ -126,11 +119,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): ...@@ -126,11 +119,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
self.assertEquals(obj3.getId(), '%s-3' %date) self.assertEquals(obj3.getId(), '%s-3' %date)
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolderMigration)) suite.addTest(unittest.makeSuite(TestFolderMigration))
return suite return suite
...@@ -26,8 +26,9 @@ ...@@ -26,8 +26,9 @@
# #
############################################################################## ##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Tool.MemcachedTool import MemcachedTool
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import installRealMemcachedTool from Products.ERP5Type.tests.utils import installRealMemcachedTool
......
...@@ -26,23 +26,13 @@ ...@@ -26,23 +26,13 @@
# #
############################################################################## ##############################################################################
import os, sys import unittest
if __name__ == '__main__': from time import time
execfile(os.path.join(sys.path[0], 'framework.py')) import gc
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG from zLOG import LOG
from Products.CMFCore.tests.base.testcase import LogInterceptor from Products.CMFCore.tests.base.testcase import LogInterceptor
from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type.Cache import clearCache
from DateTime import DateTime
from time import time
import gc
# Define variable to chek if performance are good or not # Define variable to chek if performance are good or not
# XXX These variable are specific to the testing environment # XXX These variable are specific to the testing environment
...@@ -183,11 +173,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -183,11 +173,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
self.failUnless(MIN_TIC < tic_value < MAX_TIC) self.failUnless(MIN_TIC < tic_value < MAX_TIC)
i += 1 i += 1
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPerformance)) suite.addTest(unittest.makeSuite(TestPerformance))
return suite return suite
...@@ -26,20 +26,13 @@ ...@@ -26,20 +26,13 @@
# #
############################################################################## ##############################################################################
import os, sys import unittest
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Document import newTempOrder from Products.ERP5Type.Document import newTempOrder
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG from zLOG import LOG
import time
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
...@@ -153,11 +146,7 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -153,11 +146,7 @@ class TestSessionTool(ERP5TypeTestCase):
session = portal_sessions[self.session_id] session = portal_sessions[self.session_id]
self.assert_(0 == len(session.keys())) self.assert_(0 == len(session.keys()))
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSessionTool)) suite.addTest(unittest.makeSuite(TestSessionTool))
return suite return suite
......
...@@ -25,19 +25,13 @@ ...@@ -25,19 +25,13 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder import unittest
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager, \ from AccessControl.SecurityManagement import newSecurityManager, \
noSecurityManager noSecurityManager
from AccessControl.ZopeGuards import guarded_apply, guarded_getattr from AccessControl.ZopeGuards import guarded_apply, guarded_getattr
# from Globals import guarded_getattr
from zExceptions import Unauthorized from zExceptions import Unauthorized
class TestTimerService(ERP5TypeTestCase): class TestTimerService(ERP5TypeTestCase):
...@@ -96,11 +90,7 @@ class TestTimerService(ERP5TypeTestCase): ...@@ -96,11 +90,7 @@ class TestTimerService(ERP5TypeTestCase):
# Do not care about any exception but unauthorized. # Do not care about any exception but unauthorized.
pass pass
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTimerService)) suite.addTest(unittest.makeSuite(TestTimerService))
return suite return suite
...@@ -26,14 +26,7 @@ ...@@ -26,14 +26,7 @@
# #
############################################################################## ##############################################################################
import os import unittest
import sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
...@@ -156,11 +149,7 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): ...@@ -156,11 +149,7 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor):
self.failUnlessEqual(tv['toto'], 'titi') self.failUnlessEqual(tv['toto'], 'titi')
self.failUnlessEqual(getattr(portal, vattr, None), None) self.failUnlessEqual(getattr(portal, vattr, None), None)
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTransactionalVariable)) suite.addTest(unittest.makeSuite(TestTransactionalVariable))
return suite return suite
...@@ -27,21 +27,12 @@ ...@@ -27,21 +27,12 @@
# #
############################################################################## ##############################################################################
from random import randint import unittest
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5.Document.DeliveryLine import DeliveryLine
from Products.ERP5Type.Utils import cartesianProduct from Products.ERP5Type.Utils import cartesianProduct
from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG from zLOG import LOG
try: try:
...@@ -282,11 +273,7 @@ class TestXMLMatrix(ERP5TypeTestCase): ...@@ -282,11 +273,7 @@ class TestXMLMatrix(ERP5TypeTestCase):
ZopeTestCase._print('\nTest Set Cell Range And Catalog Without Activities ') ZopeTestCase._print('\nTest Set Cell Range And Catalog Without Activities ')
self.checkSetCellRangeAndCatalog(active=0) self.checkSetCellRangeAndCatalog(active=0)
if __name__ == '__main__': def test_suite():
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestXMLMatrix)) suite.addTest(unittest.makeSuite(TestXMLMatrix))
return suite return suite
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment