Changeset 30199
- Timestamp:
- 12/01/05 17:29:46 (3 years ago)
- Files:
-
- funkload/trunk/funkload/BenchRunner.py (modified) (1 diff)
- funkload/trunk/funkload/FunkLoadTestCase.py (modified) (10 diffs)
- funkload/trunk/funkload/TestRunner.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
funkload/trunk/funkload/BenchRunner.py
r30187 r30199 476 476 help="Do not fail if css/image links are " 477 477 "not reachable.") 478 parser.add_option("", "--simple-fetch", action="store_true", 479 help="Don't load additional links like css " 480 "or images when fetching an html page.") 478 481 options, args = parser.parse_args() 479 482 if len(args) != 2: funkload/trunk/funkload/FunkLoadTestCase.py
r29933 r30199 70 70 self.options = options 71 71 self._funkload_init() 72 self.dumping = getattr(options, 'dump_dir', False) and True 73 self.viewing = getattr(options, 'firefox_view', False) 74 self.accept_invalid_links = getattr(options, 'accept_invalid_links', 75 False) 76 if self.viewing and not self.dumping: 72 self._dump_dir = getattr(options, 'dump_dir', None) 73 self._dumping = self._dump_dir and True or False 74 self._viewing = getattr(options, 'firefox_view', False) 75 self._accept_invalid_links = getattr(options, 'accept_invalid_links', 76 False) 77 self._simple_fetch = getattr(options, 'simple_fetch', False) 78 if self._viewing and not self._dumping: 77 79 # viewing requires dumping contents 78 self. dumping = True79 self. options.dump_dir = mkdtemp('_funkload')80 self._dumping = True 81 self._dump_dir = mkdtemp('_funkload') 80 82 self._loop_mode = getattr(options, 'loop_steps', False) 81 83 if self._loop_mode: … … 161 163 """Return an entry from the options or configuration file.""" 162 164 # check for a command line options 163 opt_key = '%s_%s' % (section, key)165 opt_key = '%s_%s' % (section, key) 164 166 opt_val = getattr(self.options, opt_key, None) 165 167 if opt_val: … … 219 221 self.log_response(value.response, rtype, description, 220 222 t_start, t_stop, log_body=True) 221 if self. dumping:223 if self._dumping: 222 224 self.dump_content(value.response) 223 225 raise self.failureException, str(value.response) … … 244 246 self.logd(' Done in %.3fs' % t_delta) 245 247 self.log_response(response, rtype, description, t_start, t_stop) 246 if self. dumping:248 if self._dumping: 247 249 self.dump_content(response) 248 250 return response … … 254 256 follow_redirect=True, load_auto_links=True, 255 257 sleep=True): 256 """Simulate a browser ."""258 """Simulate a browser handle redirects, load/cache css and images.""" 257 259 self._response = None 258 260 # Loop mode … … 313 315 # Load auto links (css and images) 314 316 response.is_html = is_html(response.body) 315 if load_auto_links and response.is_html :317 if load_auto_links and response.is_html and not self._simple_fetch: 316 318 self.logd(' Load css and images...') 317 319 page = response.body … … 321 323 self._browser.pageImages(url, page, self) 322 324 except HTTPError, error: 323 if self. accept_invalid_links:325 if self._accept_invalid_links: 324 326 self.logd(' ' + str(error)) 325 327 else: … … 442 444 while(True): 443 445 try: 444 response = self._browser.fetch(url, None, 445 ok_codes=[200,301,302]) 446 self._browser.fetch(url, None, ok_codes=[200,301,302]) 446 447 except SocketError: 447 448 if time.time() - time_start > time_out: … … 666 667 667 668 Use firefox to render the content if we are in rt viewing mode.""" 668 dump_dir = getattr(self.options, 'dump_dir', None)669 dump_dir = self._dump_dir 669 670 if dump_dir is None: 670 671 return … … 680 681 f.write(response.body) 681 682 f.close() 682 if self. viewing:683 if self._viewing: 683 684 cmd = 'firefox -remote "openfile(file://%s,new-tab)"' % file_path 684 685 ret = os.system(cmd) 686 if ret != 0: 687 self.logi('Failed to remote control firefox: %s' % cmd) 688 self._viewing = False 685 689 686 690 # funkload/trunk/funkload/TestRunner.py
r29933 r30199 258 258 parser.add_option("-n", "--loop-number", type="int", 259 259 dest="loop_number", default=10, 260 help="Number of loop ")260 help="Number of loop.") 261 261 parser.add_option("", "--accept-invalid-links", action="store_true", 262 262 help="Do not fail if css/image links are " 263 263 "not reachable.") 264 parser.add_option("", "--simple-fetch", action="store_true", 265 help="Don't load additional links like css " 266 "or images when fetching an html page.") 264 267 265 268
