comparison tests/tinyproxy.py @ 28778:256d90bb12fa

tests: make tinyproxy.py not import sys.argv by name
author Yuya Nishihara <yuya@tcha.org>
date Sun, 03 Apr 2016 20:12:59 +0900
parents 0023a6e1328f
children 80880ad3fccd
comparison
equal deleted inserted replaced
28777:778d947f222e 28778:256d90bb12fa
17 import BaseHTTPServer 17 import BaseHTTPServer
18 import SocketServer 18 import SocketServer
19 import os 19 import os
20 import select 20 import select
21 import socket 21 import socket
22 import sys
22 import urlparse 23 import urlparse
23 24
24 class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): 25 class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
25 __base = BaseHTTPServer.BaseHTTPRequestHandler 26 __base = BaseHTTPServer.BaseHTTPRequestHandler
26 __base_handle = __base.handle 27 __base_handle = __base.handle
138 a = open("proxy.pid", "w") 139 a = open("proxy.pid", "w")
139 a.write(str(os.getpid()) + "\n") 140 a.write(str(os.getpid()) + "\n")
140 a.close() 141 a.close()
141 142
142 if __name__ == '__main__': 143 if __name__ == '__main__':
143 from sys import argv 144 argv = sys.argv
144 if argv[1:] and argv[1] in ('-h', '--help'): 145 if argv[1:] and argv[1] in ('-h', '--help'):
145 print(argv[0], "[port [allowed_client_name ...]]") 146 print(argv[0], "[port [allowed_client_name ...]]")
146 else: 147 else:
147 if argv[2:]: 148 if argv[2:]:
148 allowed = [] 149 allowed = []