Changeset c60eac3 in indico
- Timestamp:
- 06/18/10 18:58:58 (3 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
- Children:
- bb7f27
- Parents:
- e0450d
- git-author:
- Jeremy Nguyen Xuan <jeremy.nguyen.xuan@…> (02/10/10 21:09:14)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (06/18/10 18:58:58)
- Files:
-
- 5 edited
-
indicop/BaseTest.py (modified) (2 diffs)
-
indicop/Indicop.py (modified) (16 diffs)
-
indicop/python/functional/seleniumTestCase.py (modified) (2 diffs)
-
indicop/python/unit/MaKaC_tests/conference_test.py (modified) (3 diffs)
-
setup.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indicop/BaseTest.py
ref948f rc60eac3 50 50 os.path.join(self.setupDir, 'report', filename + ".txt") 51 51 52 def createDummyUser(self): 53 from MaKaC import user 54 from MaKaC.authentication import AuthenticatorMgr 55 from MaKaC.common import HelperMaKaCInfo 56 from MaKaC.common import indexes 57 DBMgr.getInstance().startRequest() 58 59 print DBMgr.getInstance()._db 60 61 #filling info to new user 62 avatar = user.Avatar() 63 avatar.setName( "fake" ) 64 avatar.setSurName( "fake" ) 65 avatar.setOrganisation( "fake" ) 66 avatar.setLang( "en_US" ) 67 avatar.setEmail( "fake@fake.fake" ) 68 69 #registering user 70 ah = user.AvatarHolder() 71 ah.add(avatar) 72 73 print "AVATAR %s" % avatar._p_jar 74 75 #setting up the login info 76 li = user.LoginInfo( "dummyuser", "dummyuser" ) 77 ih = AuthenticatorMgr() 78 userid = ih.createIdentity( li, avatar, "Local" ) 79 ih.add( userid ) 80 81 #activate the account 82 avatar.activateAccount() 83 84 #since the DB is empty, we have to add dummy user as admin 85 minfo = HelperMaKaCInfo.getMaKaCInfoInstance() 86 al = minfo.getAdminList() 87 al.grant( avatar ) 88 89 DBMgr.getInstance().endRequest() 90 91 def deleteDummyUser(self): 92 from MaKaC import user 93 from MaKaC.authentication import AuthenticatorMgr 94 from MaKaC.common import HelperMaKaCInfo 95 from MaKaC.common import indexes 96 DBMgr.getInstance().startRequest() 97 98 #removing user from admin list 99 minfo = HelperMaKaCInfo.getMaKaCInfoInstance() 100 al = minfo.getAdminList() 101 ah = user.AvatarHolder() 102 avatar = ah.match({'email':'fake@fake.fake'})[0] 103 al.revoke( avatar ) 104 105 #remove the login info 106 userid = avatar.getIdentityList()[0] 107 ih = AuthenticatorMgr() 108 ih.removeIdentity(userid) 109 110 #unregistering the user info 111 index = indexes.IndexesHolder().getById("email") 112 index.unindexUser(avatar) 113 index = indexes.IndexesHolder().getById("name") 114 index.unindexUser(avatar) 115 index = indexes.IndexesHolder().getById("surName") 116 index.unindexUser(avatar) 117 index = indexes.IndexesHolder().getById("organisation") 118 index.unindexUser(avatar) 119 index = indexes.IndexesHolder().getById("status") 120 index.unindexUser(avatar) 52 # def createDummyUser(self): 53 # from MaKaC import user 54 # from MaKaC.authentication import AuthenticatorMgr 55 # from MaKaC.common import HelperMaKaCInfo 56 # from MaKaC.common import indexes 57 # DBMgr.getInstance().startRequest() 58 # 59 # #filling info to new user 60 # avatar = user.Avatar() 61 # avatar.setName( "fake" ) 62 # avatar.setSurName( "fake" ) 63 # avatar.setOrganisation( "fake" ) 64 # avatar.setLang( "en_US" ) 65 # avatar.setEmail( "fake@fake.fake" ) 66 # 67 # #registering user 68 # ah = user.AvatarHolder() 69 # ah.add(avatar) 70 # 71 # #setting up the login info 72 # li = user.LoginInfo( "dummyuser", "dummyuser" ) 73 # ih = AuthenticatorMgr() 74 # userid = ih.createIdentity( li, avatar, "Local" ) 75 # ih.add( userid ) 76 # 77 # #activate the account 78 # avatar.activateAccount() 79 # 80 # #since the DB is empty, we have to add dummy user as admin 81 # minfo = HelperMaKaCInfo.getMaKaCInfoInstance() 82 # al = minfo.getAdminList() 83 # al.grant( avatar ) 84 # 85 # DBMgr.getInstance().endRequest() 86 # 87 # def deleteDummyUser(self): 88 # from MaKaC import user 89 # from MaKaC.authentication import AuthenticatorMgr 90 # from MaKaC.common import HelperMaKaCInfo 91 # from MaKaC.common import indexes 92 # DBMgr.getInstance().startRequest() 93 # 94 # #removing user from admin list 95 # minfo = HelperMaKaCInfo.getMaKaCInfoInstance() 96 # al = minfo.getAdminList() 97 # ah = user.AvatarHolder() 98 # avatar = ah.match({'email':'fake@fake.fake'})[0] 99 # al.revoke( avatar ) 100 # 101 # #remove the login info 102 # userid = avatar.getIdentityList()[0] 103 # ih = AuthenticatorMgr() 104 # ih.removeIdentity(userid) 105 # 106 # #unregistering the user info 107 # index = indexes.IndexesHolder().getById("email") 108 # index.unindexUser(avatar) 109 # index = indexes.IndexesHolder().getById("name") 110 # index.unindexUser(avatar) 111 # index = indexes.IndexesHolder().getById("surName") 112 # index.unindexUser(avatar) 113 # index = indexes.IndexesHolder().getById("organisation") 114 # index.unindexUser(avatar) 115 # index = indexes.IndexesHolder().getById("status") 116 # index.unindexUser(avatar) 121 117 122 118 #removing user from list … … 138 134 139 135 return foldersArray 140 141 def startFakeDB(self, zeoPort):142 self.createNewDBFile()143 self.zeoServer = self.createDBServer(os.path.join(self.dbFolder, "Data.fs"),144 zeoPort)145 DBMgr.setInstance(DBMgr(hostname="localhost", port=zeoPort))146 147 def stopFakeDB(self):148 try:149 os.kill(self.zeoServer, signal.SIGTERM)150 except OSError, e:151 print ("Problem sending kill signal: " + str(e))152 except AttributeError, e:153 #DB has been already stopped154 pass155 156 try:157 #os.wait()158 os.waitpid(self.zeoServer, 0)159 self.removeDBFile()160 except OSError, e:161 print ("Problem waiting for ZEO Server: " + str(e))162 except AttributeError, e:163 #DB has been already stopped164 pass165 166 def restoreDBInstance(self):167 DBMgr.setInstance(None)168 169 def startProductionDB(self):170 try:171 commands.getstatusoutput(TestsConfig.getInstance().getStartDBCmd())172 except KeyError:173 print "[ERR] Not found in tests.conf: command to start production DB"174 sys.exit(1)175 176 def stopProductionDB(self):177 try:178 commands.getstatusoutput(TestsConfig.getInstance().getStopDBCmd())179 except KeyError:180 print "[ERR] Not found in tests.conf: command to stop production DB"181 sys.exit(1)182 183 def createNewDBFile(self):184 from ZODB import FileStorage, DB185 savedDir = os.getcwd()186 self.dbFolder = tempfile.mkdtemp()187 os.chdir(self.dbFolder)188 189 storage = FileStorage.FileStorage("Data.fs")190 db = DB(storage)191 connection = db.open()192 dbroot = connection.root()193 194 transaction.commit()195 196 connection.close()197 db.close()198 storage.close()199 os.chdir(savedDir)200 201 def removeDBFile(self):202 shutil.rmtree(self.dbFolder)203 204 def createDBServer(self, file, port):205 from util import TestZEOServer206 pid = os.fork()207 if pid:208 return pid209 else:210 server = TestZEOServer(port, file)211 server.start()212 -
indicop/Indicop.py
re0450d rc60eac3 34 34 import signal 35 35 import tempfile 36 import transaction 37 from MaKaC.common.db import DBMgr 36 38 from BaseTest import BaseTest 37 39 from TestsConfig import TestsConfig … … 48 50 result = False 49 51 50 #launch a fresh DB in parallel of the production DB 51 try: 52 self.startFakeDB(TestsConfig.getInstance().getFakeDBPort()) 53 except KeyError: 54 return "[ERR] Unit tests - Please, specify a FakeDBPort in tests.conf" 55 self.createDummyUser() 56 57 try: 58 coverage = Coverage.getInstance() 59 if coverage != False: 60 coverage.start() 61 62 #capturing the stderr 63 outerr = StringIO.StringIO() 64 sys.stderr = outerr 65 66 67 #retrieving tests from Indicop folder 68 args = ['nose', '--nologcapture', '--logging-clear-handlers', '-v', 69 os.path.join(self.setupDir, 'python', 'unit')] 70 #retrieving tests from plugins folder 71 for folder in self.walkThroughFolders(os.path.join(self.setupDir, 72 '..', 73 'indico', 74 'MaKaC', 75 'plugins'), 76 "/tests/python/unit"): 77 args.append(folder) 78 79 result = nose.run(argv = args) 80 81 #restoring the stderr 82 sys.stderr = sys.__stderr__ 83 84 85 if coverage: 86 returnString += coverage.stop() 87 88 s = outerr.getvalue() 89 returnString += self.writeReport("pyunit", s) 90 finally: 91 #self.deleteDummyUser() 92 #stopping the fake DB 93 self.stopFakeDB() 94 self.restoreDBInstance() 52 coverage = Coverage.getInstance() 53 if coverage != False: 54 coverage.start() 55 56 #capturing the stderr 57 outerr = StringIO.StringIO() 58 sys.stderr = outerr 59 60 61 #retrieving tests from Indicop folder 62 args = ['nose', '--nologcapture', '--logging-clear-handlers', '-v', 63 os.path.join(self.setupDir, 'python', 'unit')] 64 #retrieving tests from plugins folder 65 for folder in self.walkThroughFolders(os.path.join(self.setupDir, 66 '..', 67 'indico', 68 'MaKaC', 69 'plugins'), 70 "/tests/python/unit"): 71 args.append(folder) 72 73 result = nose.run(argv = args) 74 75 #restoring the stderr 76 sys.stderr = sys.__stderr__ 77 78 if coverage: 79 returnString += coverage.stop() 80 81 s = outerr.getvalue() 82 returnString += self.writeReport("pyunit", s) 95 83 96 84 if result: … … 149 137 class Functional(BaseTest): 150 138 def __init__(self): 151 BaseTest.__init__(self)152 139 self.child = None 153 140 … … 156 143 self.startMessage("Starting Python functional tests") 157 144 158 #Stop prod DB and launch a fresh DB on this prod db port159 self.stopProductionDB()160 self.startFakeDB(Config.getInstance().getDBConnectionParams()[1])161 162 145 try: 163 146 if not self.startSeleniumServer(): 164 147 return ('[ERR] Could not start functional tests because selenium' 165 148 ' server cannot be started.\n') 166 167 #Create dummy user and use this user to create conf, session and so on168 self.createDummyUser()169 149 170 150 #capturing the stderr … … 188 168 finally: 189 169 self.stopSeleniumServer() 190 #self.deleteDummyUser()191 170 192 171 #restoring the stderr 193 172 sys.stderr = sys.__stderr__ 194 195 #stopping the fake DB196 self.stopFakeDB()197 self.startProductionDB()198 self.restoreDBInstance()199 173 200 174 s = outerr.getvalue() … … 274 248 ' server cannot be started.\n') 275 249 try: 276 #Stop prod DB and launch a fresh DB on this prod db port277 self.stopProductionDB()278 self.startFakeDB(Config.getInstance().getDBConnectionParams()[1])279 self.createDummyUser()280 281 250 #running the test and ouputing in the console 282 251 result = nose.run(argv=['nose', '-v', os.path.join(self.setupDir, … … 285 254 finally: 286 255 self.stopSeleniumServer() 287 #stopping the fake DB288 self.stopFakeDB()289 self.startProductionDB()290 self.restoreDBInstance()291 292 256 else: 293 #launch a fresh DB in parallel of the production DB 294 try: 295 self.startFakeDB(TestsConfig.getInstance().getFakeDBPort()) 296 except KeyError: 297 return "[ERR] Please, specify a FakeDBPort in tests.conf" 298 try: 299 self.createDummyUser() 300 301 #running the test and ouputing in the console 302 result = nose.run(argv=['nose', '-v', os.path.join(self.setupDir, 303 '..', 304 self.specify)]) 305 306 finally: 307 self.deleteDummyUser() 308 #stopping the fake DB 309 self.stopFakeDB() 310 self.restoreDBInstance() 257 #running the test and ouputing in the console 258 result = nose.run(argv=['nose', '-v', os.path.join(self.setupDir, 259 '..', 260 self.specify)]) 261 311 262 if result: 312 263 return "Specified Test - Succeeded\n" … … 314 265 return "[FAIL] Specified Test - read output from console\n" 315 266 316 317 267 class TimeoutException(Exception): 318 268 """SIGALARM was sent to the process""" … … 321 271 def raise_timeout(signum, frame): 322 272 raise TimeoutException("15sec Timeout") 273 323 274 324 275 class Grid(BaseTest): … … 341 292 342 293 try: 343 #Stop prod DB and launch a fresh DB on this prod db port344 self.stopProductionDB()345 self.startFakeDB(Config.getInstance().getDBConnectionParams()[1])346 self.createDummyUser()347 294 self.gridData.setActive(True) 348 295 … … 393 340 #disable alarm 394 341 signal.alarm(0) 395 #stopping the fake DB 396 self.stopFakeDB() 397 self.startProductionDB() 398 self.restoreDBInstance() 342 399 343 return returnString 400 344 … … 450 394 '..', 451 395 'indico', 452 'MaKaC' , 'conference.py')))396 'MaKaC'))) 453 397 if statusOutput[1].find("pylint: not found") > -1: 454 398 return ("[ERR] Could not start Source Analysis - " … … 751 695 752 696 753 def main(self, s pecify, coverage, testsToRun):697 def main(self, stopAndStartProductionDB, specify, coverage, testsToRun): 754 698 755 699 returnString = "\n\n=============== ~INDICOP SAYS~ ===============\n\n" … … 758 702 self.configureTempFolders() 759 703 704 #managing the databases 705 if ('functional' in testsToRun) or ('grid' in testsToRun): 706 if stopAndStartProductionDB: 707 self.stopProductionDB() 708 self.startFakeDB(Config.getInstance().getDBConnectionParams()[1]) 709 self.createDummyUser() 710 elif 'unit' in testsToRun or 'specify' in testsToRun: 711 self.startFakeDB(TestsConfig.getInstance().getFakeDBPort()) 712 self.createDummyUser() 713 714 760 715 if coverage: 761 716 Coverage.instantiate() 717 762 718 763 719 #specified test can either be unit or functional. … … 772 728 "It has to be added in the testsDict variable\n") % test 773 729 774 self.deleteTempFolders() 730 #restoring db environment 731 if ('functional' in testsToRun) or ('grid' in testsToRun): 732 self.stopFakeDB() 733 if stopAndStartProductionDB: 734 self.startProductionDB() 735 self.restoreDBInstance() 736 elif 'unit' in testsToRun or 'specify' in testsToRun: 737 self.stopFakeDB() 738 self.restoreDBInstance() 775 739 776 740 return returnString 777 741 778 742 def configureTempFolders(self): 779 keyNames = [ 'LogDir',743 keyNames = [#'LogDir', 780 744 'ArchiveDir', 781 745 'UploadedFilesTempDir'] … … 791 755 shutil.rmtree(self.newValues[k]) 792 756 793 @classmethod 794 def getInstance(cls, jsspecify, jscoverage): 795 if cls.__instance == None: 796 cls.__instance = Indicop(jsspecify, jscoverage) 797 return cls.__instance 757 def startFakeDB(self, zeoPort): 758 self.createNewDBFile() 759 self.zeoServer = self.createDBServer(os.path.join(self.dbFolder, "Data.fs"), 760 zeoPort) 761 DBMgr.setInstance(DBMgr(hostname="localhost", port=zeoPort)) 762 763 def stopFakeDB(self): 764 try: 765 os.kill(self.zeoServer, signal.SIGTERM) 766 except OSError, e: 767 print ("Problem sending kill signal: " + str(e)) 768 769 try: 770 #os.wait() 771 os.waitpid(self.zeoServer, 0) 772 self.removeDBFile() 773 except OSError, e: 774 print ("Problem waiting for ZEO Server: " + str(e)) 775 776 def restoreDBInstance(self): 777 DBMgr.setInstance(None) 778 779 def startProductionDB(self): 780 try: 781 commands.getstatusoutput(TestsConfig.getInstance().getStartDBCmd()) 782 except KeyError: 783 print "[ERR] Not found in tests.conf: command to start production DB" 784 sys.exit(1) 785 786 def stopProductionDB(self): 787 try: 788 commands.getstatusoutput(TestsConfig.getInstance().getStopDBCmd()) 789 except KeyError: 790 print "[ERR] Not found in tests.conf: command to stop production DB" 791 sys.exit(1) 792 793 def createNewDBFile(self): 794 from ZODB import FileStorage, DB 795 savedDir = os.getcwd() 796 self.dbFolder = tempfile.mkdtemp() 797 os.chdir(self.dbFolder) 798 799 storage = FileStorage.FileStorage("Data.fs") 800 db = DB(storage) 801 connection = db.open() 802 dbroot = connection.root() 803 804 transaction.commit() 805 806 connection.close() 807 db.close() 808 storage.close() 809 os.chdir(savedDir) 810 811 def removeDBFile(self): 812 shutil.rmtree(self.dbFolder) 813 814 def createDBServer(self, file, port): 815 from util import TestZEOServer 816 pid = os.fork() 817 if pid: 818 return pid 819 else: 820 server = TestZEOServer(port, file) 821 server.start() 822 823 def createDummyUser(self): 824 from MaKaC import user 825 from MaKaC.authentication import AuthenticatorMgr 826 from MaKaC.common import HelperMaKaCInfo 827 from MaKaC.common import indexes 828 DBMgr.getInstance().startRequest() 829 830 #filling info to new user 831 avatar = user.Avatar() 832 avatar.setName( "fake" ) 833 avatar.setSurName( "fake" ) 834 avatar.setOrganisation( "fake" ) 835 avatar.setLang( "en_US" ) 836 avatar.setEmail( "fake@fake.fake" ) 837 838 #registering user 839 ah = user.AvatarHolder() 840 ah.add(avatar) 841 842 #setting up the login info 843 li = user.LoginInfo( "dummyuser", "dummyuser" ) 844 ih = AuthenticatorMgr() 845 userid = ih.createIdentity( li, avatar, "Local" ) 846 ih.add( userid ) 847 848 #activate the account 849 avatar.activateAccount() 850 851 #since the DB is empty, we have to add dummy user as admin 852 minfo = HelperMaKaCInfo.getMaKaCInfoInstance() 853 al = minfo.getAdminList() 854 al.grant( avatar ) 855 856 DBMgr.getInstance().endRequest() 857 858 def deleteDummyUser(self): 859 from MaKaC import user 860 from MaKaC.authentication import AuthenticatorMgr 861 from MaKaC.common import HelperMaKaCInfo 862 from MaKaC.common import indexes 863 DBMgr.getInstance().startRequest() 864 865 #removing user from admin list 866 minfo = HelperMaKaCInfo.getMaKaCInfoInstance() 867 al = minfo.getAdminList() 868 ah = user.AvatarHolder() 869 avatar = ah.match({'email':'fake@fake.fake'})[0] 870 al.revoke( avatar ) 871 872 #remove the login info 873 userid = avatar.getIdentityList()[0] 874 ih = AuthenticatorMgr() 875 ih.removeIdentity(userid) 876 877 #unregistering the user info 878 index = indexes.IndexesHolder().getById("email") 879 index.unindexUser(avatar) 880 index = indexes.IndexesHolder().getById("name") 881 index.unindexUser(avatar) 882 index = indexes.IndexesHolder().getById("surName") 883 index.unindexUser(avatar) 884 index = indexes.IndexesHolder().getById("organisation") 885 index.unindexUser(avatar) 886 index = indexes.IndexesHolder().getById("status") 887 index.unindexUser(avatar) -
indicop/python/functional/seleniumTestCase.py
r02143e rc60eac3 17 17 self.confId = None 18 18 self.selenium = None 19 20 19 grid = GridData.getInstance() 21 20 if grid.isActive(): … … 26 25 self.selenium.start() 27 26 28 29 27 #Handy functions from selenium and twill you might need 30 28 #set up the time between each selenium's commands (in milliseconds) 31 # self.selenium.set_speed( 1000)29 # self.selenium.set_speed(5000) 32 30 #convenient to set the browser in a known state 33 31 # tc.clear_cookies() -
indicop/python/unit/MaKaC_tests/conference_test.py
rc6ebce rc60eac3 32 32 from datetime import datetime 33 33 from pytz import timezone 34 from MaKaC.user import Avatar 34 35 35 36 import unittest 36 37 37 38 38 #def setup_module():39 #DBMgr.getInstance().startRequest()40 # 41 #def teardown_module():42 #DBMgr.getInstance().abort()43 #DBMgr.getInstance().endRequest()39 def setup_module(): 40 DBMgr.getInstance().startRequest() 41 42 def teardown_module(): 43 DBMgr.getInstance().abort() 44 DBMgr.getInstance().endRequest() 44 45 45 46 #From testCategories.py … … 53 54 54 55 def testBasicAddAndRemoveConferences(self): 55 DBMgr.getInstance().startRequest()56 # DBMgr.getInstance().startRequest() 56 57 57 58 #creation of basic category structure over which perform the tests 58 #croot=conference.Category()59 #c1=conference.Category()60 #croot._addSubCategory(c1)61 #c2=conference.Category()62 #croot._addSubCategory(c2)63 #c1_1=conference.Category()64 #c1._addSubCategory(c1_1)59 croot=conference.Category() 60 c1=conference.Category() 61 croot._addSubCategory(c1) 62 c2=conference.Category() 63 croot._addSubCategory(c2) 64 c1_1=conference.Category() 65 c1._addSubCategory(c1_1) 65 66 #checks adding a conference increases the conference number of the 66 67 # involved categories … … 69 70 conf1=conference.Conference(creator) 70 71 print conf1,creator 71 assert False 72 # conf1.setId("0") 73 # c1_1._addConference(conf1) 74 # assert (c1_1.getNumConferences()==1) 75 # assert (c1.getNumConferences()==1) 76 # assert (c2.getNumConferences()==0) 77 # assert (croot.getNumConferences()==1) 78 # conf2=conference.Conference(creator) 79 # conf2.setId("1") 80 # c2._addConference(conf2) 81 # assert (c1_1.getNumConferences()==1) 82 # assert (c1.getNumConferences()==1) 83 # assert (c2.getNumConferences()==1) 84 # assert (croot.getNumConferences()==2) 85 # c1_1.removeConference(conf1) 86 # assert (c1_1.getNumConferences()==0) 87 # assert (c1.getNumConferences()==0) 88 # assert (c2.getNumConferences()==1) 89 # assert (croot.getNumConferences()==1) 90 # c2.removeConference(conf2) 91 # assert (c1_1.getNumConferences()==0) 92 # assert (c1.getNumConferences()==0) 93 # assert (c2.getNumConferences()==0) 94 # assert (croot.getNumConferences()==0) 95 # 72 conf1.setId("0") 73 c1_1._addConference(conf1) 74 assert (c1_1.getNumConferences()==1) 75 assert (c1.getNumConferences()==1) 76 assert (c2.getNumConferences()==0) 77 assert (croot.getNumConferences()==1) 78 conf2=conference.Conference(creator) 79 conf2.setId("1") 80 c2._addConference(conf2) 81 assert (c1_1.getNumConferences()==1) 82 assert (c1.getNumConferences()==1) 83 assert (c2.getNumConferences()==1) 84 assert (croot.getNumConferences()==2) 85 c1_1.removeConference(conf1) 86 assert (c1_1.getNumConferences()==0) 87 assert (c1.getNumConferences()==0) 88 assert (c2.getNumConferences()==1) 89 assert (croot.getNumConferences()==1) 90 c2.removeConference(conf2) 91 assert (c1_1.getNumConferences()==0) 92 assert (c1.getNumConferences()==0) 93 assert (c2.getNumConferences()==0) 94 assert (croot.getNumConferences()==0) 95 96 96 # DBMgr.getInstance().getDBConnCache().close() 97 DBMgr.getInstance().endRequest(True) 97 # DBMgr.getInstance().endRequest(True)# 98 98 99 99 def testAddAndRemoveSubCategories(self): -
setup.py
rc0fc01 rc60eac3 37 37 from setuptools.command import develop, install, sdist, bdist_egg, easy_install 38 38 from setuptools import setup, find_packages, findall 39 from subprocess import Popen, PIPE40 39 41 40 EXTRA_RESOURCES_URL = "http://cdswaredev.cern.ch/indico/wiki/Admin/Installation/IndicoExtras" … … 339 338 sys.exit(-1) 340 339 340 from indicop.util import TestZEOServer 341 341 from indicop.Indicop import Indicop 342 from indicop.TestsConfig import TestsConfig 343 from MaKaC.common.Configuration import Config 342 344 testsToRun = [] 343 345 346 if self.unit: 347 testsToRun.append('unit') 344 348 if self.pylint: 345 349 testsToRun.append('pylint') … … 348 352 if self.grid: 349 353 testsToRun.append('grid') 350 if self.unit:351 testsToRun.append('unit')352 354 if self.jsunit or self.jsspecify: 353 355 testsToRun.append('jsunit') 354 356 if self.jslint: 355 357 testsToRun.append('jslint') 358 if self.specify != None: 359 testsToRun.append('specify') 356 360 if testsToRun == []: 361 testsToRun.append('unit') 357 362 testsToRun.append('functional') 358 363 testsToRun.append('grid') 359 testsToRun.append('unit')360 364 testsToRun.append('pylint') 361 365 testsToRun.append('jsunit') 362 366 testsToRun.append('jslint') 363 367 364 indicop = Indicop.getInstance(self.jsspecify, self.jscoverage) 365 result = indicop.main(self.specify, self.coverage, testsToRun) 368 #Check if we need to shutdown the production DB to run functional tests 369 stopAndStartProductionDB = False 370 if ('functional' in testsToRun) or ('grid' in testsToRun) or ((self.specify != None) and (self.specify.find('unit/') < 0)): 371 server = TestZEOServer(Config.getInstance().getDBConnectionParams()[1], 'test') 372 if server.server.can_connect(server.options.family, server.options.address): 373 print """Your production database is currently running. 374 Do you want to stop it using this command '%s' and run the tests? 375 (We will restart your produduction after the tests with this command '%s')""" % \ 376 (TestsConfig.getInstance().getStartDBCmd(), TestsConfig.getInstance().getStopDBCmd()) 377 userInput = raw_input("Press enter or type 'yes' to accept: ") 378 if userInput == 'yes' or userInput == '': 379 stopAndStartProductionDB = True 380 else: 381 print "Exiting testing framework..." 382 sys.exit(1) 383 384 385 indicop = Indicop(self.jsspecify, self.jscoverage) 386 result = indicop.main(stopAndStartProductionDB, self.specify, self.coverage, testsToRun) 366 387 367 388 print result … … 385 406 386 407 def checkIndicopJars(self): 387 from indicop. Indicopimport TestsConfig408 from indicop.TestsConfig import TestsConfig 388 409 389 410 """check if needed jars are here, if not, dowloading them and unzip a file if necessary"""
Note: See TracChangeset
for help on using the changeset viewer.
