misc/testing/test_initpkg.py - line 83
|
def check_import(modpath): |
print "checking import", modpath |
-> assert __import__(modpath) | |
test/rsession/web.py - line 5
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | |
|
""" web server for py.test |
-> """ |
|
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler |
|
import thread, threading |
import re |
import time |
import random |
import Queue |
import os |
import sys |
import socket |
|
import py |
from py.__.test.rsession.rsession import RSession |
from py.__.test.rsession import repevent |
from py.__.test import collect |
from py.__.test.rsession.webdata import json |
|
DATADIR = py.path.local(__file__).dirpath("webdata") |
FUNCTION_LIST = ["main", "show_skip", "show_traceback", "show_info", "hide_info", |
"show_host", "hide_host", "hide_messagebox", "opt_scroll"] |
|
try: |
from pypy.rpython.ootypesystem.bltregistry import MethodDesc, BasicExternal |
from pypy.translator.js.main import rpython2javascript |
from pypy.translator.js import commproxy |
from pypy.translator.js.lib.support import callback |
|
commproxy.USE_MOCHIKIT = False |
IMPORTED_PYPY = True |
except (ImportError, NameError): |
class BasicExternal(object): |
pass | |
/usr/lib/python2.5/BaseHTTPServer.py - line 77
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | |
"""HTTP server base class. |
|
Note: the class in this module doesn't implement any HTTP request; see |
SimpleHTTPServer for simple implementations of GET, HEAD and POST |
(including CGI scripts). It does, however, optionally implement HTTP/1.1 |
persistent connections, as of version 0.3. |
|
Contents: |
|
- BaseHTTPRequestHandler: HTTP request handler base class |
- test: test function |
|
XXX To do: |
|
- log requests even later (to capture byte count) |
- log user-agent header and other interesting goodies |
- send error log to separate file |
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-> |
|
|
|
|
|
|
|
|
__version__ = "0.3" |
|
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"] |
|
import sys |
import time |
import socket |
import mimetools |
import SocketServer |
|
|
DEFAULT_ERROR_MESSAGE = """\ |
<head> |
<title>Error response</title> |
</head> |
<body> |
<h1>Error response</h1> |
<p>Error code %(code)d. |
<p>Message: %(message)s. |
<p>Error code explanation: %(code)s = %(explain)s. |
</body> |
""" |
|
def _quote_html(html): |
return html.replace("&", "&").replace("<", "<").replace(">", ">") | |