Clarify documentation for new release.

This commit is contained in:
Chris Dent
2013-11-02 00:31:03 +00:00
parent 4618bf6922
commit e8d0f91a74
3 changed files with 32 additions and 33 deletions

View File

@@ -9,36 +9,30 @@ Python3 port of the important bits of wsgi-intercept, now working for
What is it?
===========
wsgi_intercept installs a WSGI application in place of a real URI for testing.
wsgi_intercept installs a WSGI application in place of a real URI for
testing. See the [PyPI page](http://pypi.python.org/pypi/wsgi_intercept)
page for more details.
Introduction
------------
Testing a WSGI application normally involves starting a server at a
local host and port, then pointing your test code to that address.
Instead, this library lets you intercept calls to any specific
host/port combination and redirect them into a WSGI application
importable by your test program. Thus, you can avoid spawning multiple
processes or threads to test your Web app.
wsgi_intercept works by replacing httplib.HTTPConnection with a
subclass, wsgi_intercept.WSGI_HTTPConnection. This class then
redirects specific server/port combinations into a WSGI application by
emulating a socket. If no intercept is registered for the host and
port requested, those requests are passed on to the standard handler.
The functions add_wsgi_intercept(host, port, app_create_fn,
script_name='') and remove_wsgi_intercept(host,port) specify which
URLs should be redirect into what applications. Note especially that
app_create_fn is a function object returning a WSGI application;
script_name becomes SCRIPT_NAME in the WSGI app's environment, if set.
New Version
Modern Version
-----------
For the new version only basic intercept functionality will be
provided, with a working implementation for `urllib2`/`urllib.request`,
`httplib`/`http.client`, `httplib2` and `requests`.
For the 2 and 3 version only some intercept functionality is provided,
with a working implementation in Python 2 for:
* `urllib2`
* `httplib`
* `httplib2`
* `requests`
and in Python 3 for:
* `urllib.request`
* `http.client`
* `httplib2`
* `requests`
If you are using Python 2 and need support for a different HTTP
client, require a version of `wsgi_intercept<0.6`.
To Do
-----

View File

@@ -1,4 +1,6 @@
import wsgi_intercept
from setuptools import setup, find_packages
CLASSIFIERS = """
@@ -16,13 +18,13 @@ Topic :: Software Development :: Testing
META = {
'name': 'wsgi_intercept',
'version': '0.2',
'version': wsgi_intercept.__version__,
'author': 'Titus Brown, Kumar McMillan, Chris Dent',
'author_email': 'cdent@peermore.com',
'description': 'wsgi_intercept installs a WSGI application in place of a real URI for testing.',
# What will the name be?
#url="http://pypi.python.org/pypi/wsgi_intercept",
'long_description': open('README.md').read(),
'url': 'http://pypi.python.org/pypi/wsgi_intercept',
'long_description': wsgi_intercept.__doc__,
'license': 'MIT License',
'classifiers': CLASSIFIERS,
'packages': find_packages(),

View File

@@ -39,9 +39,12 @@ Packages Intercepted
Unfortunately each of the Web testing frameworks uses its own specific
mechanism for making HTTP call-outs, so individual implementations are
needed. At this time there are implementations for `httplib2` and `requests`,
in both Python 2 and 3, `urllib2` and `httplib` in Python 2 and
`urllib.request` and `http.client` in Python 3.
needed. At this time there are implementations for ``httplib2`` and
``requests`` in both Python 2 and 3, ``urllib2`` and ``httplib`` in
Python 2 and ``urllib.request`` and ``http.client`` in Python 3.
If you are using Python 2 and need support for a different HTTP
client, require a version of ``wsgi_intercept<0.6``.
The best way to figure out how to use interception is to inspect
`the tests`_. More comprehensive documentation available upon