Changeset 1135
- Timestamp:
- 06/11/06 23:11:53
- Files:
-
- trunk/cherrypy/__init__.py (modified) (1 diff)
- trunk/cherrypy/_cpengine.py (modified) (2 diffs)
- trunk/cherrypy/lib/covercp.py (modified) (3 diffs)
- trunk/cherrypy/test/test.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/__init__.py
r1134 r1135 22 22 server.start() 23 23 engine.start() 24 25 codecoverage = False26 24 27 25 try: trunk/cherrypy/_cpengine.py
r1133 r1135 43 43 if conf("log_config_options", True): 44 44 cherrypy.config.output_config_map() 45 46 if cherrypy.codecoverage:47 from cherrypy.lib import covercp48 covercp.start()49 45 50 46 # Autoreload. Note that, if we're not starting our own HTTP server, … … 150 146 threadID = threading._get_ident() 151 147 if threadID not in self.seen_threads: 152 153 if cherrypy.codecoverage:154 from cherrypy.lib import covercp155 covercp.start()156 157 148 i = len(self.seen_threads) + 1 158 149 self.seen_threads[threadID] = i trunk/cherrypy/lib/covercp.py
r1095 r1135 9 9 http://www.nedbatchelder.com/code/modules/coverage.html 10 10 11 Set "cherrypy.codecoverage = True" to turn on coverage tracing. 12 Then, use the serve() function to browse the results in a web browser. 13 If you run this module from the command line, it will call serve() for you. 11 To turn on coverage tracing, use the following code: 12 13 cherrypy.engine.on_start_engine_list.insert(0, covercp.start) 14 cherrypy.engine.on_start_thread_list.insert(0, covercp.start) 15 16 Run your code, then use the covercp.serve() function to browse the 17 results in a web browser. If you run this module from the command line, 18 it will call serve() for you. 14 19 """ 15 20 … … 28 33 try: 29 34 from coverage import the_coverage as coverage 30 def start( ):35 def start(threadid=None): 31 36 coverage.start() 32 37 except ImportError: … … 38 43 warnings.warn("No code coverage will be performed; coverage.py could not be imported.") 39 44 40 def start( ):45 def start(threadid=None): 41 46 pass 42 47 trunk/cherrypy/test/test.py
r1117 r1135 174 174 http://www.nedbatchelder.com/code/modules/coverage.html 175 175 176 If neither module is found in PYTHONPATH, coverage is disabled. 176 If neither module is found in PYTHONPATH, 177 coverage is silently(!) disabled. 177 178 """ 178 179 try: … … 184 185 coverage.start() 185 186 import cherrypy 186 cherrypy.codecoverage = True 187 from cherrypy.lib import covercp 188 cherrypy.engine.on_start_engine_list.insert(0, covercp.start) 189 cherrypy.engine.on_start_thread_list.insert(0, covercp.start) 187 190 except ImportError: 188 191 coverage = None … … 192 195 """Stop the coverage tool, save results, and report.""" 193 196 import cherrypy 194 cherrypy.codecoverage = False 197 from cherrypy.lib import covercp 198 while covercp.start in cherrypy.engine.on_start_engine_list: 199 cherrypy.engine.on_start_engine_list.remove(covercp.start) 200 while covercp.start in cherrypy.engine.on_start_thread_list: 201 cherrypy.engine.on_start_thread_list.remove(covercp.start) 195 202 if self.coverage: 196 203 self.coverage.save()

