Changeset 2437
- Timestamp:
- 06/14/09 17:57:43
- Files:
-
- trunk/cherrypy/__init__.py (modified) (1 diff)
- trunk/cherrypy/_cpmodpy.py (modified) (1 diff)
- trunk/cherrypy/_cpwsgi.py (modified) (1 diff)
- trunk/cherrypy/lib/encoding.py (modified) (2 diffs)
- trunk/cherrypy/lib/profiler.py (modified) (1 diff)
- trunk/cherrypy/lib/tidy.py (modified) (1 diff)
- trunk/cherrypy/py3util.py (modified) (1 diff)
- trunk/cherrypy/test/benchmark.py (modified) (6 diffs)
- trunk/cherrypy/test/helper.py (modified) (3 diffs)
- trunk/cherrypy/test/logtest.py (modified) (5 diffs)
- trunk/cherrypy/test/modfcgid.py (modified) (1 diff)
- trunk/cherrypy/test/modpy.py (modified) (1 diff)
- trunk/cherrypy/test/modwsgi.py (modified) (1 diff)
- trunk/cherrypy/test/test.py (modified) (11 diffs)
- trunk/cherrypy/test/test_config.py (modified) (1 diff)
- trunk/cherrypy/test/test_config_server.py (modified) (2 diffs)
- trunk/cherrypy/test/test_conn.py (modified) (8 diffs)
- trunk/cherrypy/test/test_core.py (modified) (1 diff)
- trunk/cherrypy/test/test_encoding.py (modified) (1 diff)
- trunk/cherrypy/test/test_http.py (modified) (2 diffs)
- trunk/cherrypy/test/test_json.py (modified) (1 diff)
- trunk/cherrypy/test/test_request_obj.py (modified) (1 diff)
- trunk/cherrypy/test/test_session.py (modified) (4 diffs)
- trunk/cherrypy/test/test_states.py (modified) (7 diffs)
- trunk/cherrypy/test/test_static.py (modified) (2 diffs)
- trunk/cherrypy/test/test_tidy.py (modified) (1 diff)
- trunk/cherrypy/test/test_tools.py (modified) (4 diffs)
- trunk/cherrypy/test/test_wsgi_ns.py (modified) (1 diff)
- trunk/cherrypy/test/test_wsgi_vhost.py (modified) (1 diff)
- trunk/cherrypy/test/test_wsgiapps.py (modified) (3 diffs)
- trunk/cherrypy/test/webtest.py (modified) (5 diffs)
- trunk/cherrypy/tutorial/bonus-sqlobject.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/__init__.py
r2423 r2437 551 551 return newurl 552 552 553 from cherrypy.py3util import py3print554 553 555 554 # import _cpconfig last so it can reference other top-level objects trunk/cherrypy/_cpmodpy.py
r2394 r2437 57 57 58 58 import logging 59 try: 60 from cStringIO import StringIO 61 except ImportError: 62 from StringIO import StringIO 59 63 60 64 import cherrypy 61 from cherrypy.py3util import StringIO62 65 from cherrypy._cperror import format_exc, bare_error 63 66 from cherrypy.lib import httputil 64 65 67 66 68 trunk/cherrypy/_cpwsgi.py
r2432 r2437 4 4 5 5 import cherrypy as _cherrypy 6 from cherrypy.py3util import StringIO 6 try: 7 from cStringIO import StringIO 8 except ImportError: 9 from StringIO import StringIO 7 10 from cherrypy import _cperror 8 11 from cherrypy.lib import httputil trunk/cherrypy/lib/encoding.py
r2413 r2437 1 try: 2 from cStringIO import StringIO 3 except ImportError: 4 from StringIO import StringIO 1 5 try: 2 6 set … … 198 202 def decompress(body): 199 203 import gzip 200 from cherrypy.py3util import StringIO201 204 202 205 zbuf = StringIO() trunk/cherrypy/lib/profiler.py
r2394 r2437 55 55 import sys 56 56 57 from cherrypy.py3util import StringIO 57 try: 58 from cStringIO import StringIO 59 except ImportError: 60 from StringIO import StringIO 58 61 59 62 _count = 0 trunk/cherrypy/lib/tidy.py
r2394 r2437 3 3 import cgi 4 4 import os 5 from cherrypy.py3util import StringIO 5 try: 6 from cStringIO import StringIO 7 except ImportError: 8 from StringIO import StringIO 6 9 import traceback 7 10 trunk/cherrypy/py3util.py
r2413 r2437 3 3 """ 4 4 import sys 5 6 def py3print(*args, **kwargs):7 sep = kwargs.get('sep', ' ')8 end = kwargs.get('end', '\n')9 file = kwargs.get('file', sys.stdout)10 output = sep.join(['%s' % arg for arg in args]) + end11 file.write(output)12 13 try:14 from cStringIO import StringIO15 except ImportError:16 from StringIO import StringIO17 5 18 6 def sorted(lst): trunk/cherrypy/test/benchmark.py
r2389 r2437 218 218 self.output = _cpmodpy.read_process(AB_PATH or "ab", self.args()) 219 219 except: 220 cherrypy.py3print(_cperror.format_exc())220 print(_cperror.format_exc()) 221 221 raise 222 222 … … 273 273 widths.append(max(lengths)) 274 274 for row in rows: 275 cherrypy.py3print()275 print("") 276 276 for i, val in enumerate(row): 277 cherrypy.py3print(str(val).rjust(widths[i]), "|", end=' ')278 cherrypy.py3print()277 print str(val).rjust(widths[i]), "|", 278 print("") 279 279 280 280 281 281 def run_standard_benchmarks(): 282 cherrypy.py3print()283 cherrypy.py3print("Client Thread Report (1000 requests, 14 byte response body, "282 print("") 283 print("Client Thread Report (1000 requests, 14 byte response body, " 284 284 "%s server threads):" % cherrypy.server.thread_pool) 285 285 print_report(thread_report()) 286 286 287 cherrypy.py3print()288 cherrypy.py3print("Client Thread Report (1000 requests, 14 bytes via staticdir, "287 print("") 288 print("Client Thread Report (1000 requests, 14 bytes via staticdir, " 289 289 "%s server threads):" % cherrypy.server.thread_pool) 290 290 print_report(thread_report("%s/static/index.html" % SCRIPT_NAME)) 291 291 292 cherrypy.py3print()293 cherrypy.py3print("Size Report (1000 requests, 50 client threads, "292 print("") 293 print("Size Report (1000 requests, 50 client threads, " 294 294 "%s server threads):" % cherrypy.server.thread_pool) 295 295 print_report(size_report()) … … 316 316 317 317 def run_modpython(use_wsgi=False): 318 cherrypy.py3print("Starting mod_python...")318 print("Starting mod_python...") 319 319 pyopts = [] 320 320 … … 351 351 opts = dict(switches) 352 352 except getopt.GetoptError: 353 cherrypy.py3print(__doc__)353 print(__doc__) 354 354 sys.exit(2) 355 355 356 356 if "--help" in opts: 357 cherrypy.py3print(__doc__)357 print(__doc__) 358 358 sys.exit(0) 359 359 … … 366 366 def run(): 367 367 port = cherrypy.server.socket_port 368 cherrypy.py3print("You may now open http://127.0.0.1:%s%s/" %368 print("You may now open http://127.0.0.1:%s%s/" % 369 369 (port, SCRIPT_NAME)) 370 370 371 371 if "--null" in opts: 372 cherrypy.py3print("Using null Request object")372 print("Using null Request object") 373 373 else: 374 374 def run(): 375 375 end = time.time() - start 376 cherrypy.py3print("Started in %s seconds" % end)376 print("Started in %s seconds" % end) 377 377 if "--null" in opts: 378 cherrypy.py3print("\nUsing null Request object")378 print("\nUsing null Request object") 379 379 try: 380 380 run_standard_benchmarks() … … 382 382 cherrypy.engine.exit() 383 383 384 cherrypy.py3print("Starting CherryPy app server...")384 print("Starting CherryPy app server...") 385 385 386 386 class NullWriter(object): trunk/cherrypy/test/helper.py
r2392 r2437 57 57 url = httputil.urljoin(self.script_name, url) 58 58 return webtest.WebCase.getPage(self, url, headers, method, body, protocol) 59 60 def skip(self, msg='skipped '): 61 sys.stdout.write(msg) 59 62 60 63 def assertErrorPage(self, status, message=None, pattern=''): … … 84 87 self._handlewebError('Error page contains traceback') 85 88 else: 86 if (m is None) or (not re.search(re.escape(pattern), m.group(1))): 89 if (m is None) or ( 90 not re.search(re.escape(pattern), 91 m.group(1))): 87 92 msg = 'Error page does not contain %s in traceback' 88 93 self._handlewebError(msg % repr(pattern)) … … 192 197 ssl = "" 193 198 199 conf = self.config_template % { 200 'host': self.host, 201 'port': self.port, 202 'error_log': self.error_log, 203 'access_log': self.access_log, 204 'ssl': ssl, 205 'extra': extra, 206 } 194 207 f = open(self.config_file, 'wb') 195 f.write(self.config_template % 196 {'host': self.host, 197 'port': self.port, 198 'error_log': self.error_log, 199 'access_log': self.access_log, 200 'ssl': ssl, 201 'extra': extra, 202 }) 208 f.write(conf) 203 209 f.close() 204 210 trunk/cherrypy/test/logtest.py
r2389 r2437 3 3 import sys 4 4 import time 5 6 import cherrypy 5 7 6 8 … … 42 44 43 45 def _handleLogError(self, msg, data, marker, pattern): 44 cherrypy.py3print()45 cherrypy.py3print(" ERROR:",msg)46 print("") 47 print(" ERROR: %s" % msg) 46 48 47 49 if not self.interactive: … … 49 51 50 52 p = " Show: [L]og [M]arker [P]attern; [I]gnore, [R]aise, or sys.e[X]it >> " 51 cherrypy.py3print(p, end=' ')53 print p, 52 54 # ARGH 53 55 sys.stdout.flush() … … 56 58 if i not in "MPLIRX": 57 59 continue 58 cherrypy.py3print(i.upper()) # Also prints new line60 print(i.upper()) # Also prints new line 59 61 if i == "L": 60 62 for x, line in enumerate(data): 61 63 if (x + 1) % self.console_height == 0: 62 64 # The \r and comma should make the next line overwrite 63 cherrypy.py3print("<-- More -->\r", end=' ')65 print "<-- More -->\r", 64 66 m = getchar().lower() 65 67 # Erase our "More" prompt 66 cherrypy.py3print(" \r", end=' ')68 print " \r", 67 69 if m == "q": 68 70 break 69 cherrypy.py3print(line.rstrip())71 print(line.rstrip()) 70 72 elif i == "M": 71 cherrypy.py3print(repr(marker or self.lastmarker))73 print(repr(marker or self.lastmarker)) 72 74 elif i == "P": 73 cherrypy.py3print(repr(pattern))75 print(repr(pattern)) 74 76 elif i == "I": 75 77 # return without raising the normal exception … … 79 81 elif i == "X": 80 82 self.exit() 81 cherrypy.py3print(p, end=' ')83 print p, 82 84 83 85 def exit(self): trunk/cherrypy/test/modfcgid.py
r2389 r2437 111 111 result = read_process(APACHE_PATH, "-k start -f %s" % fcgiconf) 112 112 if result: 113 cherrypy.py3print(result)113 print(result) 114 114 115 115 def stop(self): trunk/cherrypy/test/modpy.py
r2389 r2437 117 117 result = read_process(APACHE_PATH, "-k start -f %s" % mpconf) 118 118 if result: 119 cherrypy.py3print(result)119 print(result) 120 120 121 121 def stop(self): trunk/cherrypy/test/modwsgi.py
r2389 r2437 116 116 result = read_process(APACHE_PATH, "-k start -f %s" % mpconf) 117 117 if result: 118 cherrypy.py3print(result)118 print(result) 119 119 120 120 # Make a request so mod_wsgi starts up our app. trunk/cherrypy/test/test.py
r2419 r2437 41 41 import cherrypy 42 42 v = sys.version.split()[0] 43 cherrypy.py3print("Python version used to run this test script:",v)44 cherrypy.py3print("CherryPy version",cherrypy.__version__)43 print("Python version used to run this test script: %s" % v) 44 print("CherryPy version: %s" % cherrypy.__version__) 45 45 if self.scheme == "https": 46 ssl = " (ssl)"46 ssl = " (ssl)" 47 47 else: 48 48 ssl = "" 49 cherrypy.py3print("HTTP server version", self.protocol, ssl)50 cherrypy.py3print("PID:",os.getpid())51 cherrypy.py3print()49 print("HTTP server version: %s%s" % (self.protocol, ssl)) 50 print("PID: %s" % os.getpid()) 51 print("") 52 52 53 53 if isinstance(conf, basestring): … … 76 76 if self.scheme == "https": 77 77 webtest.WebCase.HTTP_CONN = HTTPSConnection 78 cherrypy.py3print()79 cherrypy.py3print("Running tests:",self.server)78 print("") 79 print("Running tests: %s" % self.server) 80 80 81 81 return helper.run_test_suite(self.tests, baseconf, self.server) … … 246 246 if self.cover and self.profile: 247 247 # Print error message and exit 248 cherrypy.py3print('Error: you cannot run the profiler and the '248 print('Error: you cannot run the profiler and the ' 249 249 'coverage tool at the same time.') 250 250 sys.exit(2) … … 260 260 261 261 import cherrypy 262 cherrypy.py3print("""CherryPy Test Program262 print("""CherryPy Test Program 263 263 Usage: 264 264 test.py --help --server=* --host=%s --port=%s --1.0 --ssl --cover … … 266 266 267 267 """ % (self.__class__.host, self.__class__.port)) 268 cherrypy.py3print(' * servers:')268 print(' * servers:') 269 269 for name, val in self.available_servers.items(): 270 270 if name == self.default_server: 271 cherrypy.py3print(' --server=%s: %s (default)' % (name, val))271 print(' --server=%s: %s (default)' % (name, val)) 272 272 else: 273 cherrypy.py3print(' --server=%s: %s' % (name, val))274 275 cherrypy.py3print("""273 print(' --server=%s: %s' % (name, val)) 274 275 print(""" 276 276 277 277 --host=<name or IP addr>: use a host other than the default (%s). … … 289 289 """ % (self.__class__.host, self.__class__.port)) 290 290 291 cherrypy.py3print(' ** tests:')291 print(' ** tests:') 292 292 for name in self.available_tests: 293 cherrypy.py3print(' --' + name)293 print(' --' + name) 294 294 295 295 def start_coverage(self): … … 328 328 self.coverage.save() 329 329 self.report_coverage() 330 cherrypy.py3print("run cherrypy/lib/covercp.py as a script to serve "330 print("run cherrypy/lib/covercp.py as a script to serve " 331 331 "coverage results on port 8080") 332 332 … … 351 351 total_executed = 0 352 352 353 cherrypy.py3print()354 cherrypy.py3print("CODE COVERAGE (this might take a while)", end=' ')353 print("") 354 sys.stdout.write("CODE COVERAGE (this might take a while)") 355 355 for morf in morfs: 356 356 sys.stdout.write(".") … … 375 375 pc = 100.0 * total_executed / total_statements 376 376 377 cherrypy.py3print("\nTotal: %s Covered: %s Percent: %2d%%"377 print("\nTotal: %s Covered: %s Percent: %2d%%" 378 378 % (total_statements, total_executed, pc)) 379 379 … … 425 425 426 426 if self.profile: 427 cherrypy.py3print()428 cherrypy.py3print("run /cherrypy/lib/profiler.py as a script to serve "427 print("") 428 print("run /cherrypy/lib/profiler.py as a script to serve " 429 429 "profiling results on port 8080") 430 430 … … 497 497 import cherrypy 498 498 if clp.interactive: 499 cherrypy.py3print()499 print("") 500 500 raw_input('hit enter') 501 501 sys.exit(success) trunk/cherrypy/test/test_config.py
r2394 r2437 7 7 localDir = os.path.join(os.getcwd(), os.path.dirname(__file__)) 8 8 9 try: 10 from cStringIO import StringIO 11 except ImportError: 12 from StringIO import StringIO 13 import unittest 14 9 15 import cherrypy 10 from cherrypy.py3util import StringIO11 import unittest12 16 13 17 def setup_server(): trunk/cherrypy/test/test_config_server.py
r2413 r2437 78 78 def testMaxRequestSizePerHandler(self): 79 79 if getattr(cherrypy.server, "using_apache", False): 80 cherrypy.py3print("skipped due to known Apache differences...", end=' ') 81 return 80 return self.skip("skipped due to known Apache differences... ") 82 81 83 82 self.getPage('/tinyupload?maxlen=100', method="POST", body="x" * 100) … … 89 88 def testMaxRequestSize(self): 90 89 if getattr(cherrypy.server, "using_apache", False): 91 cherrypy.py3print("skipped due to known Apache differences...", end=' ') 92 return 90 return self.skip("skipped due to known Apache differences... ") 93 91 94 92 for size in (500, 5000, 50000): trunk/cherrypy/test/test_conn.py
r2413 r2437 93 93 def test_HTTP11(self): 94 94 if cherrypy.server.protocol_version != "HTTP/1.1": 95 cherrypy.py3print("skipped ", end=' ') 96 return 95 return self.skip() 97 96 98 97 self.PROTOCOL = "HTTP/1.1" … … 250 249 # the server will close the conn with a 408. 251 250 if cherrypy.server.protocol_version != "HTTP/1.1": 252 cherrypy.py3print("skipped ", end=' ') 253 return 251 return self.skip() 254 252 255 253 self.PROTOCOL = "HTTP/1.1" … … 291 289 # the server will close the conn without 408. 292 290 if cherrypy.server.protocol_version != "HTTP/1.1": 293 cherrypy.py3print("skipped ", end=' ') 294 return 291 return self.skip() 295 292 296 293 self.PROTOCOL = "HTTP/1.1" … … 388 385 def test_HTTP11_pipelining(self): 389 386 if cherrypy.server.protocol_version != "HTTP/1.1": 390 cherrypy.py3print("skipped ", end=' ') 391 return 387 return self.skip() 392 388 393 389 self.PROTOCOL = "HTTP/1.1" … … 426 422 def test_100_Continue(self): 427 423 if cherrypy.server.protocol_version != "HTTP/1.1": 428 cherrypy.py3print("skipped ", end=' ') 429 return 424 return self.skip() 430 425 431 426 self.PROTOCOL = "HTTP/1.1" … … 481 476 def test_readall_or_close(self): 482 477 if cherrypy.server.protocol_version != "HTTP/1.1": 483 cherrypy.py3print("skipped ", end=' ') 484 return 478 return self.skip() 485 479 486 480 self.PROTOCOL = "HTTP/1.1" … … 553 547 def test_No_Message_Body(self): 554 548 if cherrypy.server.protocol_version != "HTTP/1.1": 555 cherrypy.py3print("skipped ", end=' ') 556 return 549 return self.skip() 557 550 558 551 self.PROTOCOL = "HTTP/1.1" … … 583 576 def test_Chunked_Encoding(self): 584 577 if cherrypy.server.protocol_version != "HTTP/1.1": 585 cherrypy.py3print("skipped ", end=' ') 586 return 578 return self.skip() 587 579 588 580 if (hasattr(self, 'harness') and 589 581 "modpython" in self.harness.__class__.__name__.lower()): 590 582 # mod_python forbids chunked encoding 591 cherrypy.py3print("skipped ", end=' ') 592 return 583 return self.skip() 593 584 594 585 self.PROTOCOL = "HTTP/1.1" trunk/cherrypy/test/test_core.py
r2408 r2437 570 570 def test_expose_decorator(self): 571 571 if not sys.version_info >= (2, 5): 572 cherrypy.py3print("skipped (Python 2.5+ only)", end=' ') 573 return 572 return self.skip("skipped (Python 2.5+ only) ") 574 573 575 574 # Test @expose trunk/cherrypy/test/test_encoding.py
r2394 r2437 2 2 test.prefer_parent_path() 3 3 4 import gzip 5 try: 6 from cStringIO import StringIO 7 except ImportError: 8 from StringIO import StringIO 9 from httplib import IncompleteRead 4 10 import sys 5 import gzip 6 from httplib import IncompleteRead 11 7 12 import cherrypy 8 from cherrypy.py3util import StringIO 13 9 14 europoundUnicode = u'\x80\xa3' 10 15 sing = u"\u6bdb\u6cfd\u4e1c: Sing, Little Birdie?" trunk/cherrypy/test/test_http.py
r2389 r2437 130 130 def test_malformed_request_line(self): 131 131 if getattr(cherrypy.server, "using_apache", False): 132 cherrypy.py3print("skipped due to known Apache differences...", end=' ') 133 return 132 return self.skip("skipped due to known Apache differences...") 134 133 135 134 # Test missing version in Request-Line … … 148 147 def test_http_over_https(self): 149 148 if self.scheme != 'https': 150 cherrypy.py3print("skipped (not running HTTPS)...", end=' ') 151 return 149 return self.skip("skipped (not running HTTPS)... ") 152 150 153 151 # Try connecting without SSL. trunk/cherrypy/test/test_json.py
r2389 r2437 6 6 from cherrypy.lib.jsontools import json 7 7 if json is None: 8 cherrypy.py3print("skipped (simplejson not found) ", end=' ')8 print "skipped (simplejson not found) " 9 9 else: 10 10 def setup_server(): trunk/cherrypy/test/test_request_obj.py
r2410 r2437 710 710 def test_CONNECT_method(self): 711 711 if getattr(cherrypy.server, "using_apache", False): 712 cherrypy.py3print("skipped due to known Apache differences...", end=' ') 713 return 712 return self.skip("skipped due to known Apache differences... ") 714 713 715 714 self.getPage("/method/", method="CONNECT") trunk/cherrypy/test/test_session.py
r2389 r2437 237 237 data_dict[index] = max(data_dict[index], int(body)) 238 238 # Uncomment the following line to prove threads overlap. 239 ## cherrypy.py3print(index, end=' ')239 ## print index, 240 240 241 241 # Start <request_count> requests from each of … … 255 255 256 256 for e in errors: 257 cherrypy.py3print(e)257 print(e) 258 258 self.assertEqual(hitcount, expected) 259 259 … … 382 382 383 383 def test(self): 384 cherrypy.py3print("skipped", end=' ')384 return self.skip("memcached not reachable ") 385 385 else: 386 386 class MemcachedSessionTest(helper.CPWebCase): … … 429 429 self.getPage("/", cookies) 430 430 # Uncomment the following line to prove threads overlap. 431 ## cherrypy.py3print(index, end=' ')431 ## print index, 432 432 if not self.body.isdigit(): 433 433 self.fail(self.body) trunk/cherrypy/test/test_states.py
r2399 r2437 210 210 pass 211 211 else: 212 cherrypy.py3print(self.body)212 print(self.body) 213 213 self.fail("AssertionError: BadStatusLine not raised") 214 214 … … 231 231 # request.close is called async. 232 232 while engine.timeout_monitor.servings: 233 cherrypy.py3print(".", end=' ')233 print ".", 234 234 time.sleep(0.01) 235 235 … … 296 296 def test_daemonize(self): 297 297 if os.name not in ['posix']: 298 cherrypy.py3print("skipped (not on posix) ", end=' ') 299 return 298 return self.skip("skipped (not on posix) ") 300 299 self.HOST = '127.0.0.1' 301 300 self.PORT = 8081 … … 334 333 from signal import SIGHUP 335 334 except ImportError: 336 cherrypy.py3print("skipped (no SIGHUP) ", end=' ') 337 return 335 return self.skip("skipped (no SIGHUP) ") 338 336 339 337 # Spawn the process. … … 352 350 from signal import SIGHUP 353 351 except ImportError: 354 cherrypy.py3print("skipped (no SIGHUP) ", end=' ') 355 return 352 return self.skip("skipped (no SIGHUP) ") 356 353 357 354 if os.name not in ['posix']: 358 cherrypy.py3print("skipped (not on posix) ", end=' ') 359 return 355 return self.skip("skipped (not on posix) ") 360 356 361 357 # Spawn the process and wait, when this returns, the original process … … 388 384 from signal import SIGTERM 389 385 except ImportError: 390 cherrypy.py3print("skipped (no SIGTERM) ", end=' ') 391 return 386 return self.skip("skipped (no SIGTERM) ") 392 387 393 388 try: 394 389 from os import kill 395 390 except ImportError: 396 cherrypy.py3print("skipped (no os.kill) ", end=' ') 397 return 391 return self.skip("skipped (no os.kill) ") 398 392 399 393 # Spawn a normal, undaemonized process. … … 423 417 from signal import SIGTERM 424 418 except ImportError: 425 cherrypy.py3print("skipped (no SIGTERM) ", end=' ') 426 return 419 return self.skip("skipped (no SIGTERM) ") 427 420 428 421 try: 429 422 from os import kill 430 423 except ImportError: 431 cherrypy.py3print("skipped (no os.kill) ", end=' ') 432 return 424 return self.skip("skipped (no os.kill) ") 433 425 434 426 # Spawn a normal, undaemonized process. trunk/cherrypy/test/test_static.py
r2419 r2437 214 214 def test_file_stream(self): 215 215 if cherrypy.server.protocol_version != "HTTP/1.1": 216 cherrypy.py3print("skipped ", end=' ') 217 return 216 return self.skip() 218 217 219 218 self.PROTOCOL = "HTTP/1.1" … … 253 252 def test_file_stream_deadlock(self): 254 253 if cherrypy.server.protocol_version != "HTTP/1.1": 255 cherrypy.py3print("skipped ", end=' ') 256 return 254 return self.skip() 257 255 258 256 self.PROTOCOL = "HTTP/1.1" trunk/cherrypy/test/test_tidy.py
r2389 r2437 50 50 def test_Tidy_Tool(self): 51 51 if not os.path.exists(tidy_path) and not os.path.exists(tidy_path + ".exe"): 52 cherrypy.py3print("skipped (tidy not found) ", end=' ') 53 return 52 return self.skip("skipped (tidy not found) ") 54 53 55 54 self.getPage('/validhtml') trunk/cherrypy/test/test_tools.py
r2394 r2437 2 2 3 3 import gzip 4 try: 5 from cStringIO import StringIO 6 except ImportError: 7 from StringIO import StringIO 4 8 import sys 5 9 from httplib import IncompleteRead … … 12 16 13 17 import cherrypy 14 from cherrypy.py3util import StringIO15 18 from cherrypy import tools 16 19 … … 296 299 old_timeout = httpserver.timeout 297 300 except (AttributeError, IndexError): 298 cherrypy.py3print("skipped ", end=' ') 299 return 301 return self.skip() 300 302 301 303 try: … … 375 377 def testToolWithConfig(self): 376 378 if not sys.version_info >= (2, 5): 377 cherrypy.py3print("skipped (Python 2.5+ only)", end=' ') 378 return 379 return self.skip("skipped (Python 2.5+ only)") 379 380 380 381 self.getPage('/tooldecs/blah') trunk/cherrypy/test/test_wsgi_ns.py
r2389 r2437 77 77 def test_pipeline(self): 78 78 if not cherrypy.server.httpserver: 79 cherrypy.py3print("skipped ", end=' ') 80 return 79 return self.skip() 81 80 82 81 self.getPage("/") trunk/cherrypy/test/test_wsgi_vhost.py
r2394 r2437 34 34 def test_welcome(self): 35 35 if not cherrypy.server.using_wsgi: 36 cherrypy.py3print("skipped (not using WSGI)...", end=' ') 37 return 36 return self.skip("skipped (not using WSGI)... ") 38 37 39 38 for year in range(1997, 2008): trunk/cherrypy/test/test_wsgiapps.py
r2394 r2437 90 90 import cherrypy 91 91 if not cherrypy.server.using_wsgi: 92 cherrypy.py3print("skipped (not using WSGI)...", end=' ') 93 return 92 return self.skip("skipped (not using WSGI)... ") 94 93 self.getPage("/hosted/app1") 95 94 self.assertHeader("Content-Type", "text/plain") … … 99 98 import cherrypy 100 99 if not cherrypy.server.using_wsgi: 101 cherrypy.py3print("skipped (not using WSGI)...", end=' ') 102 return 100 return self.skip("skipped (not using WSGI)... ") 103 101 self.getPage("/hosted/app2/") 104 102 body = list("I'm a regular CherryPy page handler!") … … 110 108 import cherrypy 111 109 if not cherrypy.server.using_wsgi: 112 cherrypy.py3print("skipped (not using WSGI)...", end=' ') 113 return 110 return self.skip("skipped (not using WSGI)... ") 114 111 self.getPage("/hosted/app3") 115 112 self.assertHeader("Content-Type", "text/plain") trunk/cherrypy/test/webtest.py
r2416 r2437 244 244 def _handlewebError(self, msg): 245 245 import cherrypy 246 cherrypy.py3print()247 cherrypy.py3print(" ERROR:",msg)246 print("") 247 print(" ERROR: %s" % msg) 248 248 249 249 if not self.interactive: … … 251 251 252 252 p = " Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> " 253 cherrypy.py3print(p, end=' ')253 print p, 254 254 # ARGH! 255 255 sys.stdout.flush() … … 258 258 if i not in "BHSUIRX": 259 259 continue 260 cherrypy.py3print(i.upper()) # Also prints new line260 print(i.upper()) # Also prints new line 261 261 if i == "B": 262 262 for x, line in enumerate(self.body.splitlines()): 263 263 if (x + 1) % self.console_height == 0: 264 264 # The \r and comma should make the next line overwrite 265 cherrypy.py3print("<-- More -->\r", end=' ')265 print "<-- More -->\r", 266 266 m = getchar().lower() 267 267 # Erase our "More" prompt 268 cherrypy.py3print(" \r", end=' ')268 print " \r", 269 269 if m == "q": 270 270 break 271 cherrypy.py3print(line)271 print(line) 272 272 elif i == "H": 273 273 pprint.pprint(self.headers) 274 274 elif i == "S": 275 cherrypy.py3print(self.status)275 print(self.status) 276 276 elif i == "U": 277 cherrypy.py3print(self.url)277 print(self.url) 278 278 elif i == "I": 279 279 # return without raising the normal exception … … 283 283 elif i == "X": 284 284 self.exit() 285 cherrypy.py3print(p, end=' ')285 print p, 286 286 # ARGH 287 287 sys.stdout.flush() … … 592 592 else: 593 593 ServerError.on = True 594 cherrypy.py3print()595 cherrypy.py3print("".join(traceback.format_exception(*exc)))594 print("") 595 print("".join(traceback.format_exception(*exc))) 596 596 return True 597 597 trunk/cherrypy/tutorial/bonus-sqlobject.py
r2389 r2437 164 164 165 165 166 cherrypy.py3print("If you're running this application for the first time, please go to http://localhost:8080/reset once in order to create the database!")166 print("If you're running this application for the first time, please go to http://localhost:8080/reset once in order to create the database!") 167 167 168 168 cherrypy.quickstart(ContactManager())

