Registry / testing / wptserve

wptserve

JSON →
library4.0.3pypypi✓ verified 85d ago

wptserve is a Python web server designed for web browser testing, typically used within the web-platform-tests (WPT) framework. Version 4.0.3 is current. It provides a lightweight HTTP server with support for various protocols and features like piping, subdomains, and SSL. Releases are infrequent, tied to WPT updates.

pip install wptserve
INSTALL
IMPORT
SIG · WPTSERVE
W
wptserve
testingpythonv4.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wptserve.server.WebTestHttpd
from wptserve.server import WebTestHttpd
from wptserve import WebTestHttpd
WebTestHttpd is in the server submodule, not top-level.

Starts a simple HTTP server serving static files.

from wptserve.server import WebTestHttpd import os server = WebTestHttpd( host='localhost', port=8000, doc_root='/path/to/static/files', key_file=os.environ.get('SSL_KEY_FILE', ''), cert_file=os.environ.get('SSL_CERT_FILE', '') ) server.start() print(f"Server running at http://{server.host}:{server.port}") input("Press Enter to stop...") server.stop()
wptserve --version
Debug
Known issues
breakingPython 2 support dropped in wptserve 4.0.0. Python 3.6+ required.
fix
Upgrade to Python 3.6 or later.
affects: >=4.0.0
breakingThe 'wptserve' package on PyPI is unrelated to the 'wptserve' subpackage within wpt's tools/ serve module. Installing from PyPI gives a standalone server, not the WPT-integrated version.
fix
If you need the WPT-integrated server, use WPT's repository directly (pip install web-platform-tests).
affects: all
gotchaWebTestHttpd does not automatically resolve relative paths for doc_root; it must be an absolute path.
fix
Use os.path.abspath() to convert relative paths.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'WebTestHttpd' from 'wptserve'
Attempting to import WebTestHttpd from top-level wptserve instead of wptserve.server.
fix
Use 'from wptserve.server import WebTestHttpd'.
OSError: [Errno 98] Address already in use
Port specified is already in use by another process.
fix
Specify a different port or kill the process using the port.
wptserve.handlers.InvalidPathException
The requested path does not exist or is outside the document root.
fix
Ensure the requested file exists within the doc_root directory.
Upgrade
Version history
4.0.3latest on PyPI · released May 16, 2025
Audit
Dependencies
sixoptionalUsed for Python 2/3 compatibility (older versions)
Agent activity
27 hits · last 30 days
node
23
Resources