test-static-http.t: get kill actually working
- signal handlers take two arguments, not one
- add missing import sys
Before this patch, the
$ kill $!
at the end of the test just caused a hidden traceback, sys.exit(0) was not
executed.
The swallowed traceback was:
Traceback (most recent call last):
File "dumb.py", line 10, in <module>
run()
File "dumb.py", line 7, in run
httpd.serve_forever()
File "/usr/lib/python2.6/SocketServer.py", line 224, in serve_forever
r, w, e = select.select([self], [], [], poll_interval)
TypeError: <lambda>() takes exactly 1 argument (2 given)
--- a/tests/test-static-http.t Fri Dec 24 15:22:00 2010 +0100
+++ b/tests/test-static-http.t Sun Dec 26 11:59:07 2010 +0100
@@ -10,7 +10,7 @@
one pull
$ cat > dumb.py <<EOF
- > import BaseHTTPServer, SimpleHTTPServer, os, signal
+ > import BaseHTTPServer, SimpleHTTPServer, os, signal, sys
>
> def run(server_class=BaseHTTPServer.HTTPServer,
> handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
@@ -18,7 +18,7 @@
> httpd = server_class(server_address, handler_class)
> httpd.serve_forever()
>
- > signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
+ > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
> run()
> EOF
$ python dumb.py 2>/dev/null &