[pypy-svn] r35329 - in pypy/dist/pypy/translator/js/examples: . test
fijal at codespeak.net
fijal at codespeak.net
Tue Dec 5 20:13:43 CET 2006
Author: fijal
Date: Tue Dec 5 20:13:40 2006
New Revision: 35329
Added:
pypy/dist/pypy/translator/js/examples/test/
pypy/dist/pypy/translator/js/examples/test/__init__.py (contents, props changed)
pypy/dist/pypy/translator/js/examples/test/test_server.py (contents, props changed)
Modified:
pypy/dist/pypy/translator/js/examples/server.py
Log:
Argh. I'm fed up with stuff accidentally stopping working. Adding test (more to come...)
Modified: pypy/dist/pypy/translator/js/examples/server.py
==============================================================================
--- pypy/dist/pypy/translator/js/examples/server.py (original)
+++ pypy/dist/pypy/translator/js/examples/server.py Tue Dec 5 20:13:40 2006
@@ -29,10 +29,10 @@
from pypy.rpython.ootypesystem.bltregistry import MethodDesc, BasicExternal,\
described
-from pypy.translator.js.main import rpython2javascript, Options
+from pypy.translator.js.main import rpython2javascript, js_optiondescr
from pypy.translator.js import commproxy
-Options.debug_transform = False
+js_optiondescr.debug_transform = False
commproxy.USE_MOCHIKIT = True
class ExportedMethods(BasicExternal):
@@ -66,7 +66,7 @@
else:
self.serve_data('text/json', json.write(exec_meth(**self.parse_args(getargs))))
else:
- outp = method_to_call(self, **self.parse_args(getargs))
+ outp = method_to_call(**self.parse_args(getargs))
if isinstance(outp, (str, unicode)):
self.serve_data('text/html', outp)
elif isinstance(outp, tuple):
Added: pypy/dist/pypy/translator/js/examples/test/__init__.py
==============================================================================
Added: pypy/dist/pypy/translator/js/examples/test/test_server.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/js/examples/test/test_server.py Tue Dec 5 20:13:40 2006
@@ -0,0 +1,19 @@
+
+""" Server testing
+"""
+
+from pypy.translator.js.examples import server
+from urllib import URLopener
+
+class Handler(server.TestHandler):
+ def index(self):
+ return "xxx"
+ index.exposed = True
+
+def test_basic_startup():
+ import thread
+ # XXX: how to do this without threads?
+ httpd = server.HTTPServer(('127.0.0.1', 21210), Handler)
+ thread.start_new_thread(httpd.serve_forever, ())
+ assert URLopener().open("http://127.0.0.1:21210/index").read() == "xxx"
+
More information about the Pypy-commit
mailing list