Ignore:
Timestamp:
Jun 8, 2009 3:07:47 AM (15 years ago)
Author:
retracile
Message:

Mergebot: redesigned implementation. Still has rough edges.

Location:
mergebot/trunk/utils
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • mergebot/trunk/utils/test.py

    r16 r17  
    1212
    1313
    14 from trac.tests.functional import FunctionalTestSuite, FunctionalTestEnvironment, FunctionalTester, TwillTest, tc, b, logfile
     14from trac.tests.functional import FunctionalTestSuite, FunctionalTestEnvironment, FunctionalTester, FunctionalTwillTestCaseSetup, tc, b, logfile
    1515from trac.tests.contentgen import random_page #, random_sentence, random_word
    1616
    1717
    18 class MergeBotTestEnvironment(FunctionalTestEnvironment):
    19     """Slight change to FunctionalTestEnvironment to keep the PYTHONPATH from
    20     our environment.
    21     """
    22     def start(self):
    23         """Starts the webserver"""
    24         server = Popen(["python", "./trac/web/standalone.py",
    25                         "--port=%s" % self.port, "-s",
    26                         "--basic-auth=trac,%s," % self.htpasswd,
    27                         self.tracdir],
    28                        #env={'PYTHONPATH':'.'},
    29                        stdout=logfile, stderr=logfile,
    30                       )
    31         self.pid = server.pid
    32         time.sleep(1) # Give the server time to come up
    33 
    34     def _tracadmin(self, *args):
    35         """Internal utility method for calling trac-admin"""
    36         if call(["python", "./trac/admin/console.py", self.tracdir] +
    37                 list(args),
    38                 #env={'PYTHONPATH':'.'},
    39                 stdout=logfile, stderr=logfile):
    40             raise Exception('Failed running trac-admin with %r' % (args, ))
    41 
    42 
    43 FunctionalTestEnvironment = MergeBotTestEnvironment
     18#class MergeBotTestEnvironment(FunctionalTestEnvironment):
     19#    """Slight change to FunctionalTestEnvironment to keep the PYTHONPATH from
     20#    our environment.
     21#    """
     22#    def start(self):
     23#        """Starts the webserver"""
     24#        server = Popen(["python", "./trac/web/standalone.py",
     25#                        "--port=%s" % self.port, "-s",
     26#                        "--basic-auth=trac,%s," % self.htpasswd,
     27#                        self.tracdir],
     28#                       #env={'PYTHONPATH':'.'},
     29#                       stdout=logfile, stderr=logfile,
     30#                      )
     31#        self.pid = server.pid
     32#        time.sleep(1) # Give the server time to come up
     33#
     34#    def _tracadmin(self, *args):
     35#        """Internal utility method for calling trac-admin"""
     36#        if call(["python", "./trac/admin/console.py", self.tracdir] +
     37#                list(args),
     38#                #env={'PYTHONPATH':'.'},
     39#                stdout=logfile, stderr=logfile):
     40#            raise Exception('Failed running trac-admin with %r' % (args, ))
     41#
     42#
     43#FunctionalTestEnvironment = MergeBotTestEnvironment
    4444
    4545
     
    148148        port = 8889
    149149        baseurl = "http://localhost:%s" % port
    150         self._testenv = FunctionalTestEnvironment("testenv%s" % port, port)
     150        self._testenv = FunctionalTestEnvironment("testenv%s" % port, port, baseurl)
    151151
    152152        # Configure mergebot
     
    186186
    187187
    188 class MergeBotTestEnabled(TwillTest):
     188class MergeBotTestEnabled(FunctionalTwillTestCaseSetup):
    189189    def runTest(self):
    190190        self._tester.logout()
     
    197197
    198198
    199 class MergeBotTestQueueList(TwillTest):
     199class MergeBotTestQueueList(FunctionalTwillTestCaseSetup):
    200200    def runTest(self):
    201201        tc.follow('MergeBot')
     
    204204
    205205
    206 class MergeBotTestNoVersion(TwillTest):
     206class MergeBotTestNoVersion(FunctionalTwillTestCaseSetup):
    207207    """Verify that if a ticket does not have the version field set, it will not
    208208    appear in the MergeBot list.
     
    215215
    216216
    217 class MergeBotTestBranch(TwillTest):
     217class MergeBotTestBranch(FunctionalTwillTestCaseSetup):
    218218    def runTest(self):
    219219        """Verify that the 'branch' button works"""
     
    223223
    224224
    225 class MergeBotTestRebranch(TwillTest):
     225class MergeBotTestRebranch(FunctionalTwillTestCaseSetup):
    226226    def runTest(self):
    227227        """Verify that the 'rebranch' button works"""
     
    232232
    233233
    234 class MergeBotTestMerge(TwillTest):
     234class MergeBotTestMerge(FunctionalTwillTestCaseSetup):
    235235    def runTest(self):
    236236        """Verify that the 'merge' button works"""
     
    241241
    242242
    243 class MergeBotTestCheckMerge(TwillTest):
     243class MergeBotTestCheckMerge(FunctionalTwillTestCaseSetup):
    244244    def runTest(self):
    245245        """Verify that the 'checkmerge' button works"""
     
    250250
    251251
    252 class MergeBotTestSingleUseCase(TwillTest):
     252class MergeBotTestSingleUseCase(FunctionalTwillTestCaseSetup):
    253253    def runTest(self):
    254254        """Create a branch, make a change, checkmerge, and merge it."""
Note: See TracChangeset for help on using the changeset viewer.