diff --git a/README.md b/README.md index e0219d5..d7ffa0f 100644 --- a/README.md +++ b/README.md @@ -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 ----- diff --git a/setup.py b/setup.py index f00569f..0d62f78 100644 --- a/setup.py +++ b/setup.py @@ -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(), diff --git a/wsgi_intercept/__init__.py b/wsgi_intercept/__init__.py index d298de0..c275b4b 100644 --- a/wsgi_intercept/__init__.py +++ b/wsgi_intercept/__init__.py @@ -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