Changeset a18d19 in indico


Ignore:
Timestamp:
11/22/10 18:41:18 (3 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
Children:
483106
Parents:
69258c
git-author:
Pedro Ferreira <jose.pedro.ferreira@…> (11/22/10 18:09:36)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (11/22/10 18:41:18)
Message:

[FIX] ZEO Server loggin messages

  • Finally the test ZEO server doesn't write on the console;
  • unit tests run with --xml result in summarized output;
  • functional tests output xml too;
Location:
indico/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/tests/runners.py

    r69258c ra18d19  
    145145 
    146146 
     147class XMLOutputOption(Option): 
     148 
     149    def use_xml_output(self, obj, fname, args): 
     150 
     151        if self.value: 
     152            args += ['--with-xunit', '--xunit-file=build/%s-results.xml' % fname] 
     153        else: 
     154            args += ['-v'] 
     155 
     156 
    147157class UnitTestRunner(BaseTestRunner): 
    148158    """ 
     
    156166                      'specify': Option, 
    157167                      'log': LogToConsoleTestOption, 
    158                       'xml': Option} 
     168                      'xml': XMLOutputOption } 
    159169 
    160170    def _run(self): 
     
    166176        #retrieving tests from tests folder 
    167177        args = ['nose', '--nologcapture',  '--logging-clear-handlers', \ 
    168                 '--with-id', '-v', '-s'] 
    169  
    170         if self.options.valueOf('xml'): 
    171             args += ['--with-xunit', '--xunit-file=build/test-results.xml'] 
     178                '--with-id', '-s'] 
     179 
     180        # will set args 
     181        self._callOptions('use_xml_output', 'unit', args) 
    172182 
    173183        specific = self.options.valueOf('specify') 
     
    220230                      'specify': Option, 
    221231                      'threads': Option, 
    222                       'repeat': Option} 
     232                      'repeat': Option, 
     233                      'xml': XMLOutputOption } 
    223234 
    224235 
     
    238249 
    239250 
    240             args = ['nose', '--nologcapture', '--logging-clear-handlers', 
    241                     '-v'] 
     251            args = ['nose', '--nologcapture', '--logging-clear-handlers'] 
     252 
     253            # will set args 
     254            self._callOptions('use_xml_output', 'functional', args) 
    242255 
    243256            specific = self.options.valueOf('specify') 
     
    310323 
    311324        try: 
     325            fout = open('build/selenium.stdout.log','w') 
     326            ferr = open('build/selenium.stderr.log', 'w') 
     327 
    312328            self.child = subprocess.Popen(["java", "-jar", 
    313329                                      os.path.join(self.setupDir, 
     
    315331                                                   'functional', 
    316332                                                   TestConfig.getInstance(). 
    317                                                    getSeleniumFilename())], 
    318                                       stdout=None) 
     333                                                   getSeleniumFilename()), 
     334                                           '-log', 'build/selenium.log', 
     335                                           '-browserSideLog'], 
     336                                        stdout = fout, 
     337                                        stderr = ferr) 
    319338 
    320339        except OSError, e: 
  • indico/tests/util.py

    rdfc79a ra18d19  
    2424""" 
    2525 
    26 import os, time 
     26import os, time, logging 
    2727from multiprocessing import Process 
    2828from StringIO import StringIO 
    2929 
    3030from ZEO.runzeo import ZEOOptions, ZEOServer 
     31 
     32 
     33class SilentZEOServer(ZEOServer): 
     34    """ 
     35    A ZEO Server that doesn't write on the console 
     36    """ 
     37    def setup_default_logging(self): 
     38        # do nothing, just use whatever handler is available 
     39        pass 
    3140 
    3241 
     
    3948        self.options = ZEOOptions() 
    4049        self.options.realize(['-f', fd, '-a', '%s:%d' % (hostname, port)]) 
    41         self.server = ZEOServer(self.options) 
     50        self.server = SilentZEOServer(self.options) 
    4251 
    4352    def run(self): 
Note: See TracChangeset for help on using the changeset viewer.