[pypy-svn] r19567 - pypy/dist/pypy/translator/js/test

ericvrp at codespeak.net ericvrp at codespeak.net
Sun Nov 6 00:22:33 CET 2005


Author: ericvrp
Date: Sun Nov  6 00:22:32 2005
New Revision: 19567

Modified:
   pypy/dist/pypy/translator/js/test/browsertest.py
Log:
* Fix for pathnames with spaces
* Comment fixes
* start supporting other platforms (probably refactor into using webbrowser module)



Modified: pypy/dist/pypy/translator/js/test/browsertest.py
==============================================================================
--- pypy/dist/pypy/translator/js/test/browsertest.py	(original)
+++ pypy/dist/pypy/translator/js/test/browsertest.py	Sun Nov  6 00:22:32 2005
@@ -2,6 +2,7 @@
 import py
 from os   import system
 from cgi  import parse_qs
+from sys  import platform
 from time import sleep
 from pypy.translator.js.log import log
 log = log.browsertest
@@ -9,12 +10,20 @@
 
 class config:
 
-    #XXX remove this hardcoding (currently OSX only)
-    browser = ('/Applications/Firefox.app/Contents/MacOS/', 'firefox-bin')
-
-    #XXX Safari does not accept a http://... format, it still thinks it's a file://...
-    #browser = ('/Applications/Safari.app/Contents/MacOS/', 'Safari')
-
+    #XXX refactor this into using the webbrowser module 
+    #    (http://docs.python.org/lib/module-webbrowser.html)
+    if platform == 'darwin':
+        browser = ('/Applications/Firefox.app/Contents/MacOS/', 'firefox-bin')
+
+        #XXX Safari does not accept a http://... format, it still thinks it's a file://...
+        #browser = ('/Applications/Safari.app/Contents/MacOS/', 'Safari')
+
+    elif platform == 'linux2':
+        browser = ('/usr/bin/', 'firefox')
+
+    else:   #win32...
+        browser = ('', 'firefox-bin')
+        
     http_port = 10001
 
     html_page = """<html>
@@ -46,9 +55,6 @@
 </body>
 </html>"""
 
-    #issue a GET after one second
-    #note: 0 second did not work probably because the GET would
-    #      be received before the refresh socket was closed (or so)
     refresh_page = """<html>
 <head>
 <meta http-equiv="refresh" content="0">
@@ -148,7 +154,7 @@
         driver = BrowserTest()
         driver.start_server(config.http_port)
 
-        cmd = '%s%s http://localhost:%d &' % (browser_path, browser_exe, config.http_port)
+        cmd = '"%s%s" http://localhost:%d &' % (browser_path, browser_exe, config.http_port)
         log(cmd)
         system(cmd)
 



More information about the Pypy-commit mailing list