Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1741

Show
Ignore:
Timestamp:
10/08/07 23:57:59
Author:
fumanchu
Message:

Test suite: prefer command-line args to base conf.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/test/helper.py

    r1735 r1741  
    103103 
    104104def run_test_suite(moduleNames, server, conf): 
    105     """Run the given test modules using the given server and conf. 
     105    """Run the given test modules using the given server and [global] conf. 
    106106     
    107107    The server is started and stopped once, regardless of the number 
  • trunk/cherrypy/test/test.py

    r1729 r1741  
    3737     
    3838    def run(self, conf=None): 
    39         """Run the test harness.""" 
     39        """Run the test harness (using the given [global] conf).""" 
    4040        import cherrypy 
    4141        v = sys.version.split()[0] 
     
    5050         
    5151        if isinstance(conf, basestring): 
    52             conf = cherrypy.config._Parser().dict_from_file(conf) 
    53         baseconf = {'server.socket_host': self.host, 
    54                     'server.socket_port': self.port, 
    55                     'server.thread_pool': 10, 
    56                     'environment': "test_suite", 
    57                     } 
    58         baseconf.update(conf or {}) 
    59          
    60         baseconf['server.protocol_version'] = self.protocol 
     52            parser = cherrypy.config._Parser() 
     53            conf = parser.dict_from_file(conf).get('global', {}) 
     54        else: 
     55            conf = conf or {} 
     56        baseconf = conf.copy() 
     57        baseconf.update({'server.socket_host': self.host, 
     58                         'server.socket_port': self.port, 
     59                         'server.protocol_version': self.protocol, 
     60                         'environment': "test_suite", 
     61                         }) 
    6162        if self.scheme == "https": 
    6263            baseconf['server.ssl_certificate'] = serverpem 
     
    293294     
    294295    def run(self, conf=None): 
    295         """Run the test harness.""" 
     296        """Run the test harness (using the given [global] conf).""" 
     297        conf = conf or {} 
     298         
    296299        # Start the coverage tool before importing cherrypy, 
    297300        # so module-level global statements are covered. 
     
    300303         
    301304        if self.profile: 
    302             conf = conf or {} 
    303305            conf['profiling.on'] = True 
    304306         
    305307        if self.validate: 
    306             conf = conf or {} 
    307308            conf['validator.on'] = True 
    308309         
    309310        if self.conquer: 
    310             conf = conf or {} 
    311311            conf['conquer.on'] = True 
    312312         

Hosted by WebFaction

Log in as guest/cpguest to create tickets