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 @@
#
##############################################################################
import os
import sys
__version__ = '0.2.3'
# Save start state
......
......@@ -32,15 +32,8 @@
# usage: python runUnitTest.py [OPTION]... namingConventionTest.py
#
import os
import sys
import re
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'
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -80,11 +73,7 @@ class TestNamingConvention(ERP5TypeTestCase):
problems = int(problems_re.search(result).group(1))
self.assertEquals(0, problems, result)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestNamingConvention))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestNamingConvention))
return suite
......@@ -33,14 +33,7 @@
#
import os
import sys
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'
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -63,11 +56,8 @@ class TestZelenium(ERP5TypeTestCase):
def testInformation(self):
self.assert_(False, 'This script is intended to be used with --save option.')
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestZelenium))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestZelenium))
return suite
......@@ -31,10 +31,7 @@
import smtplib
import re
from datetime import date
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
from email.Message import Message
......
......@@ -26,21 +26,14 @@
#
##############################################################################
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'
import time
import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.CachePlugins.DummyCache import DummyCache
from Products.ERP5Type.Cache import CachingMethod
from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG
import time
try:
from transaction import get as get_transaction
......@@ -284,12 +277,8 @@ return result
## Cache cleared shouldn't be previously cached
self.assert_(1.0 < calculation_time)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCacheTool))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCacheTool))
return suite
......@@ -26,6 +26,8 @@
#
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......
......@@ -31,7 +31,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import installRealClassTool
from zLOG import LOG
import time
try:
from transaction import get as get_transaction
......
......@@ -25,17 +25,11 @@
# 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
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
import unittest
from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase
from AccessControl.SecurityManagement import newSecurityManager, \
noSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
class TestConstraint(PropertySheetTestCase):
......@@ -1314,11 +1308,7 @@ class TestConstraint(PropertySheetTestCase):
sequence_list.play(self, quiet=quiet)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConstraint))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConstraint))
return suite
......@@ -26,22 +26,14 @@
#
##############################################################################
import os
import sys
import md5
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'
import unittest
from random import randint
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG, INFO
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.tests.utils import installRealClassTool
from Products.ERP5Type.Utils import removeLocalPropertySheet
......@@ -1355,11 +1347,7 @@ class TestPropertySheet:
obj.setFooBar('something')
self.assertTrue(obj.hasFooBar())
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Type))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Type))
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
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'
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
......@@ -152,11 +170,7 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
self.assertRaises(ValueError, self.folder.newContent,
portal_type='Category')
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolder))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolder))
return suite
# -*- coding: latin1 -*-
##############################################################################
#
# Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
......@@ -26,19 +27,11 @@
#
##############################################################################
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'
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
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
class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
......@@ -126,11 +119,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
self.assertEquals(obj3.getId(), '%s-3' %date)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolderMigration))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolderMigration))
return suite
......@@ -26,8 +26,9 @@
#
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Tool.MemcachedTool import MemcachedTool
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import installRealMemcachedTool
......
......@@ -26,23 +26,13 @@
#
##############################################################################
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'
import unittest
from time import time
import gc
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
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
# XXX These variable are specific to the testing environment
......@@ -183,11 +173,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
self.failUnless(MIN_TIC < tic_value < MAX_TIC)
i += 1
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPerformance))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPerformance))
return suite
......@@ -26,20 +26,13 @@
#
##############################################################################
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'
import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Document import newTempOrder
from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG
import time
try:
from transaction import get as get_transaction
......@@ -153,12 +146,8 @@ class TestSessionTool(ERP5TypeTestCase):
session = portal_sessions[self.session_id]
self.assert_(0 == len(session.keys()))
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSessionTool))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSessionTool))
return suite
......@@ -25,19 +25,13 @@
# 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
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager, \
noSecurityManager
from AccessControl.ZopeGuards import guarded_apply, guarded_getattr
# from Globals import guarded_getattr
from zExceptions import Unauthorized
class TestTimerService(ERP5TypeTestCase):
......@@ -96,11 +90,7 @@ class TestTimerService(ERP5TypeTestCase):
# Do not care about any exception but unauthorized.
pass
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTimerService))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTimerService))
return suite
......@@ -26,14 +26,7 @@
#
##############################################################################
import os
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'
import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -156,11 +149,7 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor):
self.failUnlessEqual(tv['toto'], 'titi')
self.failUnlessEqual(getattr(portal, vattr, None), None)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTransactionalVariable))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTransactionalVariable))
return suite
......@@ -27,21 +27,12 @@
#
##############################################################################
from random import randint
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'
import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5.Document.DeliveryLine import DeliveryLine
from Products.ERP5Type.Utils import cartesianProduct
from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG
try:
......@@ -282,11 +273,7 @@ class TestXMLMatrix(ERP5TypeTestCase):
ZopeTestCase._print('\nTest Set Cell Range And Catalog Without Activities ')
self.checkSetCellRangeAndCatalog(active=0)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestXMLMatrix))
return suite
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestXMLMatrix))
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