wiki:pywebsocket: a WebSocket server for layout tests

Version 5 (modified by, 8 years ago) (diff)


pywebsocket: a WebSocket server for layout tests

If you have a question about pywebsocket, please contact toyoshim, or bashi at

For Developers who want to use WebSocket in their layout tests

pywebsocket is automatically launched via new-run-webkit-tests, or run-webkit-tests. These script check if layout tests which are going to be run require WebSocket server, then launch pywebsocket automatically. This script just check the path of tests. If your test contains 'websocket' in its path, pywebsocket will be launched. E.g.,

  • LayoutTests/http/tests/websocket
  • LayoutTests/http/tests/inspector/websocket.

Where and Why

Originally, pywebsocket is automatically installed by webkitpy's autoinstall, when you need it to run a layout test at runtime. But after r116668, it is checked in WebKit repository directly. This is because an autoinstall bug which is already fixed (See, chromium issue 80739). After this change, chromium build bots introduce a limitation that they can only get HTTP pages via a proxy. If you are going to re-enable autoinstall mechanism, please add proxies support to autoinstall. You can check the discussion here.

How to manage(update) pywebsocket in WebKit

Here is a basic process to update.

1) Remove old files.

$ cd WebKit/Tools/Scripts/webkitpy/thirdparty
$ rm -rf mod_pywebsocket

2) Import newly released revision.

$ tar zxf mod_pywebsocket-''version''.tar.gz
$ mv pywebsocket-''version''/src/mod_pywebsocket .
$ mv pywebsocket-''version''/src/COPYING mod_pywebsocket
$ rm -rf pywebsocket-''version''
$ git status # Check if there is untracked new files, and handle it if needed.

3) Register to local repository.

$ git commit -a -m "import pywebsocket-''version''"

4) Run tests. (You should run after submitting to local repos. because running tests generators garbages like *.pyc)

$ cd ../../../..
$ ./Tools/Scripts/test-webkitpy # I expect they don't depend on pywebsocket for now, but it will finish in short time, so I recommend to run it.
$ ./Tools/Scripts/new-run-webkit-websocketserver --server=start
$ ./Tools/Scripts/new-run-webkit-websocketserver --server=stop
$ ./Tools/Scripts/run-webkit-websocketserver # This script use new-run-webkit-websocketserver internally, so this might be redundant.

5) Request review and submit the change in the WebKit way. You may want to include following description in ChangeLog

  • pywebsocket version (or revision) to import
  • new features' description (or URL to GoogleCode's download page containing that)

Don't forget to copy COPYING in 2).


Chromium port has another pywebsocket checkout at src/third_party/pywebsocket via DEPS mechanism. This is for testing chromium specific features. Versions of both pywebsocket will be slightly different.