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

Changeset 2438

Show
Ignore:
Timestamp:
06/14/09 18:00:03
Author:
fumanchu
Message:

python3: Removed py3util.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/python3/cherrypy/__init__.py

    r2422 r2438  
    548548    return newurl 
    549549 
    550 from cherrypy.py3util import py3print 
    551550 
    552551# import _cpconfig last so it can reference other top-level objects 
  • branches/python3/cherrypy/_cpmodpy.py

    r2183 r2438  
    5757 
    5858import logging 
    59 import io 
     59from io import BytesIO 
    6060 
    6161import cherrypy 
     
    220220                        path = ir.path 
    221221                        qs = ir.query_string 
    222                         rfile = io.StringIO() 
     222                        rfile = BytesIO() 
    223223                 
    224224                send_response(req, response.status, response.header_list, 
  • branches/python3/cherrypy/_cpwsgi.py

    r2433 r2438  
    44 
    55import cherrypy as _cherrypy 
    6 from cherrypy.py3util import StringIO 
     6from io import BytesIO 
    77from cherrypy import _cperror 
    88from cherrypy.lib import httputil 
     
    151151        env['PATH_INFO'] = path 
    152152        env['QUERY_STRING'] = query_string 
    153         env['wsgi.input'] = StringIO() 
     153        env['wsgi.input'] = BytesIO() 
    154154        env['CONTENT_LENGTH'] = "0" 
    155155         
  • branches/python3/cherrypy/lib/encoding.py

    r2420 r2438  
    1 import io 
     1from io import IOBase, BytesIO 
    22import struct 
    33import time 
     
    145145                # [''] doesn't evaluate to False, so replace it with []. 
    146146                self.body = [] 
    147         elif isinstance(self.body, io.IOBase): 
     147        elif isinstance(self.body, IOBase): 
    148148            self.body = file_generator(self.body) 
    149149        elif self.body is None: 
     
    194194def decompress(body): 
    195195    import gzip 
    196     import io 
    197      
    198     zbuf = io.BytesIO() 
     196     
     197    zbuf = BytesIO() 
    199198    zbuf.write(body) 
    200199    zbuf.seek(0) 
  • branches/python3/cherrypy/lib/profiler.py

    r2395 r2438  
    5555import sys 
    5656 
    57 from cherrypy.py3util import StringIO 
     57from io import StringIO 
    5858 
    5959_count = 0 
     
    8686        """stats(index) -> output of print_stats() for the given profile.""" 
    8787        sio = StringIO() 
    88         if sys.version_info >= (2, 5): 
    89             s = pstats.Stats(os.path.join(self.path, filename), stream=sio) 
    90             s.strip_dirs() 
    91             s.sort_stats(sortby) 
    92             s.print_stats() 
    93         else: 
    94             # pstats.Stats before Python 2.5 didn't take a 'stream' arg, 
    95             # but just printed to stdout. So re-route stdout. 
    96             s = pstats.Stats(os.path.join(self.path, filename)) 
    97             s.strip_dirs() 
    98             s.sort_stats(sortby) 
    99             oldout = sys.stdout 
    100             try: 
    101                 sys.stdout = sio 
    102                 s.print_stats() 
    103             finally: 
    104                 sys.stdout = oldout 
     88        s = pstats.Stats(os.path.join(self.path, filename), stream=sio) 
     89        s.strip_dirs() 
     90        s.sort_stats(sortby) 
     91        s.print_stats() 
    10592        response = sio.getvalue() 
    10693        sio.close() 
  • branches/python3/cherrypy/lib/tidy.py

    r2395 r2438  
    33import cgi 
    44import os 
    5 from cherrypy.py3util import StringIO 
     5from io import StringIO 
    66import traceback 
    77 
  • branches/python3/cherrypy/test/benchmark.py

    r2390 r2438  
    218218            self.output = _cpmodpy.read_process(AB_PATH or "ab", self.args()) 
    219219        except: 
    220             cherrypy.py3print(_cperror.format_exc()) 
     220            print(_cperror.format_exc()) 
    221221            raise 
    222222         
     
    273273        widths.append(max(lengths)) 
    274274    for row in rows: 
    275         cherrypy.py3print(
     275        print(""
    276276        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]), "|", end=' ') 
     278    print(""
    279279 
    280280 
    281281def 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, " 
    284284           "%s server threads):" % cherrypy.server.thread_pool) 
    285285    print_report(thread_report()) 
    286286     
    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, " 
    289289           "%s server threads):" % cherrypy.server.thread_pool) 
    290290    print_report(thread_report("%s/static/index.html" % SCRIPT_NAME)) 
    291291     
    292     cherrypy.py3print(
    293     cherrypy.py3print("Size Report (1000 requests, 50 client threads, " 
     292    print(""
     293    print("Size Report (1000 requests, 50 client threads, " 
    294294           "%s server threads):" % cherrypy.server.thread_pool) 
    295295    print_report(size_report()) 
     
    316316 
    317317def run_modpython(use_wsgi=False): 
    318     cherrypy.py3print("Starting mod_python...") 
     318    print("Starting mod_python...") 
    319319    pyopts = [] 
    320320     
     
    351351        opts = dict(switches) 
    352352    except getopt.GetoptError: 
    353         cherrypy.py3print(__doc__) 
     353        print(__doc__) 
    354354        sys.exit(2) 
    355355     
    356356    if "--help" in opts: 
    357         cherrypy.py3print(__doc__) 
     357        print(__doc__) 
    358358        sys.exit(0) 
    359359     
     
    366366        def run(): 
    367367            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/" % 
    369369                   (port, SCRIPT_NAME)) 
    370370             
    371371            if "--null" in opts: 
    372                 cherrypy.py3print("Using null Request object") 
     372                print("Using null Request object") 
    373373    else: 
    374374        def run(): 
    375375            end = time.time() - start 
    376             cherrypy.py3print("Started in %s seconds" % end) 
     376            print("Started in %s seconds" % end) 
    377377            if "--null" in opts: 
    378                 cherrypy.py3print("\nUsing null Request object") 
     378                print("\nUsing null Request object") 
    379379            try: 
    380380                run_standard_benchmarks() 
     
    382382                cherrypy.engine.exit() 
    383383     
    384     cherrypy.py3print("Starting CherryPy app server...") 
     384    print("Starting CherryPy app server...") 
    385385     
    386386    class NullWriter(object): 
  • branches/python3/cherrypy/test/helper.py

    r2393 r2438  
    5757            url = httputil.urljoin(self.script_name, url) 
    5858        return webtest.WebCase.getPage(self, url, headers, method, body, protocol) 
     59     
     60    def skip(self, msg='skipped '): 
     61        sys.stdout.write(msg) 
    5962     
    6063    def assertErrorPage(self, status, message=None, pattern=''): 
     
    194197            ssl = "" 
    195198         
     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            } 
    196207        f = open(self.config_file, 'wb') 
    197         f.write(bytes(self.config_template % 
    198                 {'host': self.host, 
    199                  'port': self.port, 
    200                  'error_log': self.error_log, 
    201                  'access_log': self.access_log, 
    202                  'ssl': ssl, 
    203                  'extra': extra, 
    204                  }, 'utf8')) 
     208        f.write(bytes(conf, 'utf8')) 
    205209        f.close() 
    206210     
  • branches/python3/cherrypy/test/logtest.py

    r2430 r2438  
    4444     
    4545    def _handleLogError(self, msg, data, marker, pattern): 
    46         cherrypy.py3print(
    47         cherrypy.py3print("    ERROR:", msg) 
     46        print(""
     47        print("    ERROR: %s" % msg) 
    4848         
    4949        if not self.interactive: 
     
    5151         
    5252        p = "    Show: [L]og [M]arker [P]attern; [I]gnore, [R]aise, or sys.e[X]it >> " 
    53         cherrypy.py3print(p, end=' ') 
     53        print(p, end=' ') 
    5454        # ARGH 
    5555        sys.stdout.flush() 
     
    5858            if i not in "MPLIRX": 
    5959                continue 
    60             cherrypy.py3print(i.upper())  # Also prints new line 
     60            print(i.upper())  # Also prints new line 
    6161            if i == "L": 
    6262                for x, line in enumerate(data): 
    6363                    if (x + 1) % self.console_height == 0: 
    6464                        # The \r and comma should make the next line overwrite 
    65                         cherrypy.py3print("<-- More -->\r", end=' ') 
     65                        print("<-- More -->\r", end=' ') 
    6666                        m = getchar().lower() 
    6767                        # Erase our "More" prompt 
    68                         cherrypy.py3print("            \r", end=' ') 
     68                        print("            \r", end=' ') 
    6969                        if m == "q": 
    7070                            break 
    71                     cherrypy.py3print(line.rstrip()) 
     71                    print(line.rstrip()) 
    7272            elif i == "M": 
    73                 cherrypy.py3print(repr(marker or self.lastmarker)) 
     73                print(repr(marker or self.lastmarker)) 
    7474            elif i == "P": 
    75                 cherrypy.py3print(repr(pattern)) 
     75                print(repr(pattern)) 
    7676            elif i == "I": 
    7777                # return without raising the normal exception 
     
    8181            elif i == "X": 
    8282                self.exit() 
    83             cherrypy.py3print(p, end=' ') 
     83            print(p, end=' ') 
    8484     
    8585    def exit(self): 
  • branches/python3/cherrypy/test/modfcgid.py

    r2390 r2438  
    111111        result = read_process(APACHE_PATH, "-k start -f %s" % fcgiconf) 
    112112        if result: 
    113             cherrypy.py3print(result) 
     113            print(result) 
    114114     
    115115    def stop(self): 
  • branches/python3/cherrypy/test/modpy.py

    r2390 r2438  
    117117        result = read_process(APACHE_PATH, "-k start -f %s" % mpconf) 
    118118        if result: 
    119             cherrypy.py3print(result) 
     119            print(result) 
    120120     
    121121    def stop(self): 
  • branches/python3/cherrypy/test/modwsgi.py

    r2390 r2438  
    116116        result = read_process(APACHE_PATH, "-k start -f %s" % mpconf) 
    117117        if result: 
    118             cherrypy.py3print(result) 
     118            print(result) 
    119119         
    120120        # Make a request so mod_wsgi starts up our app. 
  • branches/python3/cherrypy/test/test.py

    r2420 r2438  
    4141        import cherrypy 
    4242        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__) 
    4545        if self.scheme == "https": 
    46             ssl = "(ssl)" 
     46            ssl = " (ssl)" 
    4747        else: 
    4848            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(""
    5252         
    5353        if isinstance(conf, str): 
     
    7676        if self.scheme == "https": 
    7777            webtest.WebCase.HTTP_CONN = HTTPSConnection 
    78         cherrypy.py3print(
    79         cherrypy.py3print("Running tests:", self.server) 
     78        print(""
     79        print("Running tests: %s" % self.server) 
    8080         
    8181        return helper.run_test_suite(self.tests, baseconf, self.server) 
     
    246246        if self.cover and self.profile: 
    247247            # 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 ' 
    249249                   'coverage tool at the same time.') 
    250250            sys.exit(2) 
     
    260260         
    261261        import cherrypy 
    262         cherrypy.py3print("""CherryPy Test Program 
     262        print("""CherryPy Test Program 
    263263    Usage: 
    264264        test.py --help --server=* --host=%s --port=%s --1.0 --ssl --cover 
     
    266266         
    267267    """ % (self.__class__.host, self.__class__.port)) 
    268         cherrypy.py3print('    * servers:') 
     268        print('    * servers:') 
    269269        for name, val in self.available_servers.items(): 
    270270            if name == self.default_server: 
    271                 cherrypy.py3print('        --server=%s: %s (default)' % (name, val)) 
     271                print('        --server=%s: %s (default)' % (name, val)) 
    272272            else: 
    273                 cherrypy.py3print('        --server=%s: %s' % (name, val)) 
    274          
    275         cherrypy.py3print(""" 
     273                print('        --server=%s: %s' % (name, val)) 
     274         
     275        print(""" 
    276276     
    277277    --host=<name or IP addr>: use a host other than the default (%s). 
     
    289289    """ % (self.__class__.host, self.__class__.port)) 
    290290         
    291         cherrypy.py3print('    ** tests:') 
     291        print('    ** tests:') 
    292292        for name in self.available_tests: 
    293             cherrypy.py3print('        --' + name) 
     293            print('        --' + name) 
    294294     
    295295    def start_coverage(self): 
     
    328328            self.coverage.save() 
    329329            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 " 
    331331                   "coverage results on port 8080") 
    332332     
     
    351351        total_executed = 0 
    352352         
    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)"
    355355        for morf in morfs: 
    356356            sys.stdout.write(".") 
     
    375375            pc = 100.0 * total_executed / total_statements 
    376376         
    377         cherrypy.py3print("\nTotal: %s Covered: %s Percent: %2d%%" 
     377        print("\nTotal: %s Covered: %s Percent: %2d%%" 
    378378               % (total_statements, total_executed, pc)) 
    379379     
     
    425425         
    426426        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 " 
    429429                   "profiling results on port 8080") 
    430430         
     
    497497    import cherrypy 
    498498    if clp.interactive: 
    499         cherrypy.py3print(
     499        print(""
    500500        input('hit enter') 
    501501    sys.exit(success) 
  • branches/python3/cherrypy/test/test_config.py

    r2395 r2438  
    77localDir = os.path.join(os.getcwd(), os.path.dirname(__file__)) 
    88 
     9from io import StringIO 
     10import unittest 
     11 
    912import cherrypy 
    10 from cherrypy.py3util import StringIO 
    11 import unittest 
    1213 
    1314def setup_server(): 
  • branches/python3/cherrypy/test/test_config_server.py

    r2412 r2438  
    7979    def testMaxRequestSizePerHandler(self): 
    8080        if getattr(cherrypy.server, "using_apache", False): 
    81             cherrypy.py3print("skipped due to known Apache differences...", end=' ') 
    82             return 
     81            return self.skip("skipped due to known Apache differences... ") 
    8382         
    8483        self.getPage('/tinyupload?maxlen=100', method="POST", body="x" * 100) 
     
    9089    def testMaxRequestSize(self): 
    9190        if getattr(cherrypy.server, "using_apache", False): 
    92             cherrypy.py3print("skipped due to known Apache differences...", end=' ') 
    93             return 
     91            return self.skip("skipped due to known Apache differences... ") 
    9492         
    9593        for size in (500, 5000, 50000): 
  • branches/python3/cherrypy/test/test_conn.py

    r2412 r2438  
    9393    def test_HTTP11(self): 
    9494        if cherrypy.server.protocol_version != "HTTP/1.1": 
    95             cherrypy.py3print("skipped ", end=' ') 
    96             return 
     95            return self.skip() 
    9796         
    9897        self.PROTOCOL = "HTTP/1.1" 
     
    250249        # the server will close the conn with a 408. 
    251250        if cherrypy.server.protocol_version != "HTTP/1.1": 
    252             cherrypy.py3print("skipped ", end=' ') 
    253             return 
     251            return self.skip() 
    254252         
    255253        self.PROTOCOL = "HTTP/1.1" 
     
    291289        # the server will close the conn without 408. 
    292290        if cherrypy.server.protocol_version != "HTTP/1.1": 
    293             cherrypy.py3print("skipped ", end=' ') 
    294             return 
     291            return self.skip() 
    295292         
    296293        self.PROTOCOL = "HTTP/1.1" 
     
    387384    def test_HTTP11_pipelining(self): 
    388385        if cherrypy.server.protocol_version != "HTTP/1.1": 
    389             cherrypy.py3print("skipped ", end=' ') 
    390             return 
     386            return self.skip() 
    391387         
    392388        self.PROTOCOL = "HTTP/1.1" 
     
    425421    def test_100_Continue(self): 
    426422        if cherrypy.server.protocol_version != "HTTP/1.1": 
    427             cherrypy.py3print("skipped ", end=' ') 
    428             return 
     423            return self.skip() 
    429424         
    430425        self.PROTOCOL = "HTTP/1.1" 
     
    480475    def test_readall_or_close(self): 
    481476        if cherrypy.server.protocol_version != "HTTP/1.1": 
    482             cherrypy.py3print("skipped ", end=' ') 
    483             return 
     477            return self.skip() 
    484478         
    485479        self.PROTOCOL = "HTTP/1.1" 
     
    552546    def test_No_Message_Body(self): 
    553547        if cherrypy.server.protocol_version != "HTTP/1.1": 
    554             cherrypy.py3print("skipped ", end=' ') 
    555             return 
     548            return self.skip() 
    556549         
    557550        self.PROTOCOL = "HTTP/1.1" 
     
    582575    def test_Chunked_Encoding(self): 
    583576        if cherrypy.server.protocol_version != "HTTP/1.1": 
    584             cherrypy.py3print("skipped ", end=' ') 
    585             return 
     577            return self.skip() 
    586578         
    587579        if (hasattr(self, 'harness') and 
    588580            "modpython" in self.harness.__class__.__name__.lower()): 
    589581            # mod_python forbids chunked encoding 
    590             cherrypy.py3print("skipped ", end=' ') 
    591             return 
     582            return self.skip() 
    592583         
    593584        self.PROTOCOL = "HTTP/1.1" 
  • branches/python3/cherrypy/test/test_encoding.py

    r2403 r2438  
    22test.prefer_parent_path() 
    33 
     4import gzip 
     5from io import BytesIO 
     6from http.client import IncompleteRead 
    47import sys 
    5 import gzip, io 
    6 from http.client import IncompleteRead 
     8 
    79import cherrypy 
     10 
    811europoundUnicode = '\x80\xa3' 
    912sing = "\u6bdb\u6cfd\u4e1c: Sing, Little Birdie?" 
     
    126129     
    127130    def testGzip(self): 
    128         zbuf = io.BytesIO() 
     131        zbuf = BytesIO() 
    129132        zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9) 
    130133        zfile.write("Hello, world") 
  • branches/python3/cherrypy/test/test_http.py

    r2390 r2438  
    131131    def test_malformed_request_line(self): 
    132132        if getattr(cherrypy.server, "using_apache", False): 
    133             cherrypy.py3print("skipped due to known Apache differences...", end=' ') 
    134             return 
     133            return self.skip("skipped due to known Apache differences...") 
    135134         
    136135        # Test missing version in Request-Line 
     
    149148    def test_http_over_https(self): 
    150149        if self.scheme != 'https': 
    151             cherrypy.py3print("skipped (not running HTTPS)...", end=' ') 
    152             return 
     150            return self.skip("skipped (not running HTTPS)... ") 
    153151         
    154152        # Try connecting without SSL. 
  • branches/python3/cherrypy/test/test_request_obj.py

    r2411 r2438  
    708708    def test_CONNECT_method(self): 
    709709        if getattr(cherrypy.server, "using_apache", False): 
    710             cherrypy.py3print("skipped due to known Apache differences...", end=' ') 
    711             return 
     710            return self.skip("skipped due to known Apache differences... ") 
    712711         
    713712        self.getPage("/method/", method="CONNECT") 
  • branches/python3/cherrypy/test/test_session.py

    r2436 r2438  
    243243                    data_dict[index] = max(data_dict[index], int(body)) 
    244244                # Uncomment the following line to prove threads overlap. 
    245 ##                cherrypy.py3print(index, end=' ') 
     245##                print(index, end=' ') 
    246246         
    247247        # Start <request_count> requests from each of 
     
    261261         
    262262        for e in errors: 
    263             cherrypy.py3print(e) 
     263            print(e) 
    264264        self.assertEqual(hitcount, expected) 
    265265     
     
    376376         
    377377        def test(self): 
    378             cherrypy.py3print("skipped", end=' '
     378            return self.skip("memcached not reachable "
    379379else: 
    380380    class MemcachedSessionTest(helper.CPWebCase): 
     
    423423                    self.getPage("/", cookies) 
    424424                    # Uncomment the following line to prove threads overlap. 
    425 ##                    cherrypy.py3print(index, end=' ') 
     425##                    print(index, end=' ') 
    426426                if not self.body.isdigit(): 
    427427                    self.fail(self.body) 
  • branches/python3/cherrypy/test/test_states.py

    r2390 r2438  
    210210            pass 
    211211        else: 
    212             cherrypy.py3print(self.body) 
     212            print(self.body) 
    213213            self.fail("AssertionError: BadStatusLine not raised") 
    214214         
     
    231231            # request.close is called async. 
    232232            while engine.timeout_monitor.servings: 
    233                 cherrypy.py3print(".", end=' ') 
     233                print(".", end=' ') 
    234234                time.sleep(0.01) 
    235235             
     
    296296    def test_daemonize(self): 
    297297        if os.name not in ['posix']:  
    298             cherrypy.py3print("skipped (not on posix) ", end=' ') 
    299             return 
     298            return self.skip("skipped (not on posix) ") 
    300299        self.HOST = '127.0.0.1' 
    301300        self.PORT = 8081 
     
    334333            from signal import SIGHUP 
    335334        except ImportError: 
    336             cherrypy.py3print("skipped (no SIGHUP) ", end=' ') 
    337             return 
     335            return self.skip("skipped (no SIGHUP) ") 
    338336         
    339337        # Spawn the process. 
     
    352350            from signal import SIGHUP 
    353351        except ImportError: 
    354             cherrypy.py3print("skipped (no SIGHUP) ", end=' ') 
    355             return 
     352            return self.skip("skipped (no SIGHUP) ") 
    356353         
    357354        if os.name not in ['posix']:  
    358             cherrypy.py3print("skipped (not on posix) ", end=' ') 
    359             return 
     355            return self.skip("skipped (not on posix) ") 
    360356         
    361357        # Spawn the process and wait, when this returns, the original process 
     
    388384            from signal import SIGTERM 
    389385        except ImportError: 
    390             cherrypy.py3print("skipped (no SIGTERM) ", end=' ') 
    391             return 
     386            return self.skip("skipped (no SIGTERM) ") 
    392387         
    393388        try: 
    394389            from os import kill 
    395390        except ImportError: 
    396             cherrypy.py3print("skipped (no os.kill) ", end=' ') 
    397             return 
     391            return self.skip("skipped (no os.kill) ") 
    398392         
    399393        # Spawn a normal, undaemonized process. 
     
    423417            from signal import SIGTERM 
    424418        except ImportError: 
    425             cherrypy.py3print("skipped (no SIGTERM) ", end=' ') 
    426             return 
     419            return self.skip("skipped (no SIGTERM) ") 
    427420         
    428421        try: 
    429422            from os import kill 
    430423        except ImportError: 
    431             cherrypy.py3print("skipped (no os.kill) ", end=' ') 
    432             return 
     424            return self.skip("skipped (no os.kill) ") 
    433425         
    434426        # Spawn a normal, undaemonized process. 
  • branches/python3/cherrypy/test/test_static.py

    r2420 r2438  
    211211    def test_file_stream(self): 
    212212        if cherrypy.server.protocol_version != "HTTP/1.1": 
    213             cherrypy.py3print("skipped ", end=' ') 
    214             return 
     213            return self.skip() 
    215214         
    216215        self.PROTOCOL = "HTTP/1.1" 
     
    250249    def test_file_stream_deadlock(self): 
    251250        if cherrypy.server.protocol_version != "HTTP/1.1": 
    252             cherrypy.py3print("skipped ", end=' ') 
    253             return 
     251            return self.skip() 
    254252         
    255253        self.PROTOCOL = "HTTP/1.1" 
  • branches/python3/cherrypy/test/test_tidy.py

    r2390 r2438  
    5050    def test_Tidy_Tool(self): 
    5151        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) ") 
    5453         
    5554        self.getPage('/validhtml') 
  • branches/python3/cherrypy/test/test_tools.py

    r2390 r2438  
    22 
    33import gzip 
    4 import io 
     4from io import BytesIO 
    55import sys 
    66from http.client import IncompleteRead 
     
    9595     
    9696    def stream_handler(next_handler, *args, **kwargs): 
    97         cherrypy.response.output = o = io.BytesIO() 
     97        cherrypy.response.output = o = BytesIO() 
    9898        try: 
    9999            response = next_handler(*args, **kwargs) 
     
    328328            old_timeout = httpserver.timeout 
    329329        except (AttributeError, IndexError): 
    330             cherrypy.py3print("skipped ", end=' ') 
    331             return 
     330            return self.skip() 
    332331         
    333332        try: 
     
    368367    def testCombinedTools(self): 
    369368        expectedResult = ("Hello,world" + europoundUnicode).encode('utf-8') 
    370         zbuf = io.BytesIO() 
     369        zbuf = BytesIO() 
    371370        zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9) 
    372371        zfile.write(expectedResult) 
     
    377376        self.assertInBody(zbuf.getvalue()[:3]) 
    378377         
    379         zbuf = io.BytesIO() 
     378        zbuf = BytesIO() 
    380379        zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=6) 
    381380        zfile.write(expectedResult) 
     
    407406    def testToolWithConfig(self): 
    408407        if not sys.version_info >= (2, 5): 
    409             cherrypy.py3print("skipped (Python 2.5+ only)", end=' ') 
    410             return 
     408            return self.skip("skipped (Python 2.5+ only)") 
    411409         
    412410        self.getPage('/tooldecs/blah') 
  • branches/python3/cherrypy/test/test_wsgi_ns.py

    r2390 r2438  
    7777    def test_pipeline(self): 
    7878        if not cherrypy.server.httpserver: 
    79             cherrypy.py3print("skipped ", end=' ') 
    80             return 
     79            return self.skip() 
    8180         
    8281        self.getPage("/") 
  • branches/python3/cherrypy/test/test_wsgi_vhost.py

    r2390 r2438  
    3434    def test_welcome(self): 
    3535        if not cherrypy.server.using_wsgi: 
    36             cherrypy.py3print("skipped (not using WSGI)...", end=' ') 
    37             return 
     36            return self.skip("skipped (not using WSGI)... ") 
    3837         
    3938        for year in range(1997, 2008): 
  • branches/python3/cherrypy/test/test_wsgiapps.py

    r2430 r2438  
    9090        import cherrypy 
    9191        if not cherrypy.server.using_wsgi: 
    92             cherrypy.py3print("skipped (not using WSGI)...", end=' ') 
    93             return 
     92            return self.skip("skipped (not using WSGI)... ") 
    9493        self.getPage("/hosted/app1") 
    9594        self.assertHeader("Content-Type", "text/plain") 
     
    9998        import cherrypy 
    10099        if not cherrypy.server.using_wsgi: 
    101             cherrypy.py3print("skipped (not using WSGI)...", end=' ') 
    102             return 
     100            return self.skip("skipped (not using WSGI)... ") 
    103101        self.getPage("/hosted/app2/") 
    104102        body = list("I'm a regular CherryPy page handler!") 
     
    110108        import cherrypy 
    111109        if not cherrypy.server.using_wsgi: 
    112             cherrypy.py3print("skipped (not using WSGI)...", end=' ') 
    113             return 
     110            return self.skip("skipped (not using WSGI)... ") 
    114111        self.getPage("/hosted/app3") 
    115112        self.assertHeader("Content-Type", "text/plain") 
  • branches/python3/cherrypy/test/webtest.py

    r2415 r2438  
    252252    def _handlewebError(self, msg): 
    253253        import cherrypy 
    254         cherrypy.py3print(
    255         cherrypy.py3print("    ERROR:", msg) 
     254        print(""
     255        print("    ERROR: %s" % msg) 
    256256         
    257257        if not self.interactive: 
     
    259259         
    260260        p = "    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> " 
    261         cherrypy.py3print(p, end=' ') 
     261        print(p, end=' ') 
    262262        # ARGH! 
    263263        sys.stdout.flush() 
     
    268268            if i not in "BHSUIRX": 
    269269                continue 
    270             cherrypy.py3print(i.upper())  # Also prints new line 
     270            print(i.upper())  # Also prints new line 
    271271            if i == "B": 
    272272                for x, line in enumerate(self.body.splitlines()): 
    273273                    if (x + 1) % self.console_height == 0: 
    274274                        # The \r and comma should make the next line overwrite 
    275                         cherrypy.py3print("<-- More -->\r", end=' ') 
     275                        print("<-- More -->\r", end=' ') 
    276276                        m = getchar().lower() 
    277277                        # Erase our "More" prompt 
    278                         cherrypy.py3print("            \r", end=' ') 
     278                        print("            \r", end=' ') 
    279279                        if m == "q": 
    280280                            break 
    281                     cherrypy.py3print(line) 
     281                    print(line) 
    282282            elif i == "H": 
    283283                pprint.pprint(self.headers) 
    284284            elif i == "S": 
    285                 cherrypy.py3print(self.status) 
     285                print(self.status) 
    286286            elif i == "U": 
    287                 cherrypy.py3print(self.url) 
     287                print(self.url) 
    288288            elif i == "I": 
    289289                # return without raising the normal exception 
     
    293293            elif i == "X": 
    294294                self.exit() 
    295             cherrypy.py3print(p, end=' ') 
     295            print(p, end=' ') 
    296296            # ARGH 
    297297            sys.stdout.flush()     
     
    605605    else: 
    606606        ServerError.on = True 
    607         cherrypy.py3print(
    608         cherrypy.py3print("".join(traceback.format_exception(*exc))) 
     607        print(""
     608        print("".join(traceback.format_exception(*exc))) 
    609609        return True 
    610610 
  • branches/python3/cherrypy/tutorial/bonus-sqlobject.py

    r2390 r2438  
    164164 
    165165 
    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!") 
     166print("If you're running this application for the first time, please go to http://localhost:8080/reset once in order to create the database!") 
    167167 
    168168cherrypy.quickstart(ContactManager()) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets